Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flatten refs recursive #1258

Merged
merged 3 commits into from Feb 9, 2023

Conversation

tvt173
Copy link
Collaborator

@tvt173 tvt173 commented Feb 9, 2023

I noticed a bug in the new flatten_invalid_refs_recursive function which caused some refs to drop. While debugging, I realized there is also a bug in the setter of ComponentReference.parent and also ref_cell, that the actual gdstk cell does not update when you set it to something new. This MR fixes both of those issues.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 9, 2023

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 1.40%.

Quality metrics Before After Change
Complexity 6.01 ⭐ 5.57 ⭐ -0.44 👍
Method Length 62.65 🙂 60.82 ⭐ -1.83 👍
Working memory 7.79 🙂 8.02 🙂 0.23 👎
Quality 67.16% 🙂 68.56% 🙂 1.40% 👍
Other metrics Before After Change
Lines 3144 3117 -27
Changed files Quality Before Quality After Quality Change
gdsfactory/component.py 64.87% 🙂 66.58% 🙂 1.71% 👍
gdsfactory/component_reference.py 72.66% 🙂 73.11% 🙂 0.45% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/component.py Component._write_library 20 😞 356 ⛔ 18 ⛔ 23.01% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/component_reference.py ComponentReference.move 15 🙂 280 ⛔ 15 😞 31.99% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/component.py Component.plot_holoviews 14 🙂 475 ⛔ 12 😞 33.50% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/component.py Component.add_polygon 18 🙂 282 ⛔ 12 😞 33.79% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/component.py Component.remap_layers 29 😞 216 ⛔ 10 😞 33.89% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Merging #1258 (aadbb52) into main (6c3d6cd) will increase coverage by 0.46%.
The diff coverage is 87.80%.

@@            Coverage Diff             @@
##             main    #1258      +/-   ##
==========================================
+ Coverage   68.75%   69.22%   +0.46%     
==========================================
  Files         356      356              
  Lines       21150    21177      +27     
  Branches     3038     3044       +6     
==========================================
+ Hits        14542    14659     +117     
+ Misses       5752     5633     -119     
- Partials      856      885      +29     
Impacted Files Coverage Δ
gdsfactory/component.py 67.99% <87.09%> (-0.27%) ⬇️
gdsfactory/component_reference.py 75.19% <90.00%> (+0.46%) ⬆️
gdsfactory/write_cells.py 72.94% <0.00%> (-5.54%) ⬇️
gdsfactory/pdk.py 55.32% <0.00%> (ø)
gdsfactory/klive.py 68.42% <0.00%> (ø)
gdsfactory/components/__init__.py 100.00% <0.00%> (ø)
gdsfactory/show.py 50.00% <0.00%> (+2.94%) ⬆️
gdsfactory/components/disk.py 81.25% <0.00%> (+5.57%) ⬆️
gdsfactory/routing/all_angle.py 26.33% <0.00%> (+18.30%) ⬆️
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@joamatab
Copy link
Contributor

joamatab commented Feb 9, 2023

Thank you Troy!

@joamatab joamatab merged commit 085241c into gdsfactory:main Feb 9, 2023
@joamatab
Copy link
Contributor

joamatab commented Feb 9, 2023

just released v6.36.0

joamatab added a commit that referenced this pull request Feb 20, 2023
Fix flatten refs recursive

Former-commit-id: 085241c
joamatab added a commit that referenced this pull request Feb 20, 2023
Fix flatten refs recursive

Former-commit-id: 0d151cc [formerly 085241c]
Former-commit-id: 69a4136
joamatab added a commit that referenced this pull request Feb 23, 2023
Fix flatten refs recursive

Former-commit-id: 0d151cc [formerly de9ae78 [formerly fe16a3a421d04cd2d74f9f769de5c1953bd0eb45] [formerly 69a4136 [formerly 085241c]]]
Former-commit-id: 69a4136
Former-commit-id: b1c9a5869283e28900ea90242738bf5d2d08530d [formerly da31440]
Former-commit-id: abeef4532b3e574d86409894c8ccaca1fcaf2eac
simbilod pushed a commit to simbilod/gdsfactory that referenced this pull request Mar 2, 2023
…sive

Fix flatten refs recursive

Former-commit-id: 69a4136 [formerly 085241c]
Former-commit-id: fe16a3a421d04cd2d74f9f769de5c1953bd0eb45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants