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

[WIP] Technology Refactor (Sourcery refactored) #1042

Closed
wants to merge 37 commits into from

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Dec 24, 2022

Pull Request #1014 refactored by Sourcery.

Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to
    the original Pull Request

    Incorporate changes via command line
    git fetch https://github.com/gdsfactory/gdsfactory pull/1014/head
    git merge --ff-only FETCH_HEAD
    git push

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Help us improve this pull request!

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Dec 24, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.16%.

Quality metrics Before After Change
Complexity 16.67 🙂 18.00 🙂 1.33 👎
Method Length 104.56 🙂 106.44 🙂 1.88 👎
Working memory 14.12 😞 14.53 😞 0.41 👎
Quality 50.76% 🙂 49.60% 😞 -1.16% 👎
Other metrics Before After Change
Lines 18821 16905 -1916
Changed files Quality Before Quality After Quality Change
gdsfactory/__init__.py 51.85% 🙂 51.85% 🙂 0.00%
gdsfactory/add_keepout.py 75.89% ⭐ 75.89% ⭐ 0.00%
gdsfactory/circuitviz.py 42.93% 😞 43.03% 😞 0.10% 👍
gdsfactory/cli.py 84.96% ⭐ 84.96% ⭐ 0.00%
gdsfactory/component.py 69.52% 🙂 69.00% 🙂 -0.52% 👎
gdsfactory/config.py 71.02% 🙂 69.76% 🙂 -1.26% 👎
gdsfactory/cross_section.py 51.35% 🙂 51.13% 🙂 -0.22% 👎
gdsfactory/decorators.py 83.87% ⭐ 83.34% ⭐ -0.53% 👎
gdsfactory/install.py 75.30% ⭐ 75.15% ⭐ -0.15% 👎
gdsfactory/materials.py 93.69% ⭐ 93.06% ⭐ -0.63% 👎
gdsfactory/pdk.py 65.66% 🙂 65.62% 🙂 -0.04% 👎
gdsfactory/quickplotter.py 56.99% 🙂 56.84% 🙂 -0.15% 👎
gdsfactory/types.py 49.24% 😞 50.58% 🙂 1.34% 👍
gdsfactory/components/greek_cross.py 45.00% 😞 45.81% 😞 0.81% 👍
gdsfactory/components/pad_gsg.py 57.13% 🙂 57.16% 🙂 0.03% 👍
gdsfactory/components/straight_heater_metal.py 44.48% 😞 44.48% 😞 0.00%
gdsfactory/components/text_rectangular.py 46.92% 😞 46.98% 😞 0.06% 👍
gdsfactory/components/via_stack.py 40.29% 😞 41.06% 😞 0.77% 👍
gdsfactory/export/to_3d.py 45.84% 😞 46.39% 😞 0.55% 👍
gdsfactory/export/to_stl.py 49.81% 😞 50.77% 🙂 0.96% 👍
gdsfactory/geometry/check_width.py 79.09% ⭐ 79.09% ⭐ 0.00%
gdsfactory/geometry/get_xsection_script.py 82.06% ⭐ 82.06% ⭐ 0.00%
gdsfactory/labels/add_label_yaml.py 44.38% 😞 44.29% 😞 -0.09% 👎
gdsfactory/labels/write_labels.py 61.13% 🙂 61.71% 🙂 0.58% 👍
gdsfactory/read/from_yaml.py 22.42% ⛔ 22.27% ⛔ -0.15% 👎
gdsfactory/routing/manhattan.py 30.17% 😞 30.27% 😞 0.10% 👍
gdsfactory/samples/demo/layers.py 61.04% 🙂 61.04% 🙂 0.00%
gdsfactory/samples/pdk/fab_c.py 62.35% 🙂 62.35% 🙂 0.00%
gdsfactory/simulation/add_simulation_markers.py 53.98% 🙂 53.98% 🙂 0.00%
gdsfactory/simulation/get_sparameters_path.py 80.35% ⭐ 80.35% ⭐ 0.00%
gdsfactory/simulation/devsim/doping.py 87.58% ⭐ 87.58% ⭐ 0.00%
gdsfactory/simulation/devsim/get_simulation.py 19.33% ⛔ 19.33% ⛔ 0.00%
gdsfactory/simulation/devsim/get_solver.py 58.38% 🙂 78.57% ⭐ 20.19% 👍
gdsfactory/simulation/eme/meow_eme.py 59.94% 🙂 60.12% 🙂 0.18% 👍
gdsfactory/simulation/eme/test_meow_simulation.py 65.55% 🙂 65.55% 🙂 0.00%
gdsfactory/simulation/fem/mode_solver.py 31.21% 😞 51.85% 🙂 20.64% 👍
gdsfactory/simulation/fem/test_mode_solver.py 81.36% ⭐ 81.36% ⭐ 0.00%
gdsfactory/simulation/gmeep/get_meep_geometry.py 28.69% 😞 28.69% 😞 0.00%
gdsfactory/simulation/gmeep/get_simulation.py 23.58% ⛔ 23.58% ⛔ 0.00%
gdsfactory/simulation/gmeep/meep_adjoint_optimization.py 46.59% 😞 46.59% 😞 0.00%
gdsfactory/simulation/gmeep/test_write_sparameters_meep.py 75.87% ⭐ 75.87% ⭐ 0.00%
gdsfactory/simulation/gmeep/write_sparameters_meep.py 25.48% 😞 25.48% 😞 0.00%
gdsfactory/simulation/gmeep/write_sparameters_meep_batch.py 29.64% 😞 29.64% 😞 0.00%
gdsfactory/simulation/gmeep/write_sparameters_meep_mpi.py 33.63% 😞 33.62% 😞 -0.01% 👎
gdsfactory/simulation/gmsh/meshtracker.py 73.67% 🙂 73.67% 🙂 0.00%
gdsfactory/simulation/gmsh/parse_component.py 58.54% 🙂 58.54% 🙂 0.00%
gdsfactory/simulation/gmsh/parse_gds.py 71.18% 🙂 71.18% 🙂 0.00%
gdsfactory/simulation/gmsh/parse_layerstack.py 79.76% ⭐ 79.76% ⭐ 0.00%
gdsfactory/simulation/gmsh/uz_xsection_mesh.py 48.46% 😞 49.39% 😞 0.93% 👍
gdsfactory/simulation/gmsh/xy_xsection_mesh.py 45.64% 😞 45.64% 😞 0.00%
gdsfactory/simulation/gmsh/scratch/mesh3D.py 45.57% 😞 45.57% 😞 0.00%
gdsfactory/simulation/gmsh/tests/test_meshing.py 84.38% ⭐ 80.44% ⭐ -3.94% 👎
gdsfactory/simulation/gtidy3d/get_simulation.py 14.85% ⛔ 14.85% ⛔ 0.00%
gdsfactory/simulation/gtidy3d/get_simulation_grating_coupler.py 7.90% ⛔ 7.90% ⛔ 0.00%
gdsfactory/simulation/lumerical/read.py 44.47% 😞 44.47% 😞 0.00%
gdsfactory/simulation/lumerical/write_sparameters_lumerical.py 19.54% ⛔ 19.56% ⛔ 0.02% 👍
gdsfactory/simulation/modes/get_mode_solver_cross_section.py 57.23% 🙂 57.16% 🙂 -0.07% 👎
gdsfactory/simulation/thermal/heater.py 45.19% 😞 45.19% 😞 0.00%
gdsfactory/tests/test_add_pins.py 83.39% ⭐ 83.39% ⭐ 0.00%
gdsfactory/tests/test_layerstack.py 99.50% ⭐ 99.50% ⭐ 0.00%
gdsfactory/tests/test_paths_extrude.py 75.67% ⭐ 72.71% 🙂 -2.96% 👎
gdsfactory/tests/test_klayout/test_klayout_tech.py 93.45% ⭐ 93.37% ⭐ -0.08% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/circuitviz.py viz_bk 112 ⛔ 1037 ⛔ 0.12% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
gdsfactory/routing/manhattan.py round_corners 80 ⛔ 1341 ⛔ 42 ⛔ 0.67% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/read/from_yaml.py _from_yaml 125 ⛔ 1109 ⛔ 28 ⛔ 1.24% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/gtidy3d/get_simulation.py get_simulation 55 ⛔ 1335 ⛔ 50 ⛔ 2.41% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/read/from_yaml.py place 63 ⛔ 642 ⛔ 27 ⛔ 3.01% ⛔ 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!

@sourcery-ai sourcery-ai bot force-pushed the sourcery/pull-1014 branch 2 times, most recently from 205c958 to 2909474 Compare January 2, 2023 21:26
@sourcery-ai sourcery-ai bot changed the title [WIP] Unify layer display properties between KLayout, matplotlib, and holoviews (Sourcery refactored) [WIP] Technology Refactor (Sourcery refactored) Jan 3, 2023
@sourcery-ai sourcery-ai bot force-pushed the sourcery/pull-1014 branch 3 times, most recently from 43b8bfe to 0703a9f Compare January 3, 2023 03:10
@joamatab joamatab closed this Jan 7, 2023
@sourcery-ai sourcery-ai bot deleted the sourcery/pull-1014 branch January 7, 2023 20:48
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