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

Sourcery refactored master branch #27

Merged
merged 1 commit into from May 2, 2022
Merged

Sourcery refactored master branch #27

merged 1 commit into from May 2, 2022

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Apr 28, 2022

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

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

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from joamatab April 28, 2022 20:31
Comment on lines +2 to +7

import os
import pathlib
import sys

if sys.platform == "win32":
klayout_folder = "KLayout"
else:
klayout_folder = ".klayout"


klayout_folder = "KLayout" if sys.platform == "win32" else ".klayout"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 6-11 refactored with the following changes:

dl = (np.arccos(2 * power_per_cent / 100 - 1)) / beta
return dl
return (np.arccos(2 * power_per_cent / 100 - 1)) / beta
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_length refactored with the following changes:

Comment on lines -28 to +32
if n == 4 and label in ["opt1", "opt2"]:
return 180
if n == 4 and label in ["opt3", "opt4"]:
return 0
if n == 4:
if label in {"opt1", "opt2"}:
return 180
if label in {"opt3", "opt4"}:
return 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function guess_port_orientaton refactored with the following changes:

Comment on lines -60 to +61
n = 0
for label in c.get_labels():
if label.text.startswith("opt"):
n += 1

n = sum(1 for label in c.get_labels() if label.text.startswith("opt"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function add_ports refactored with the following changes:

Comment on lines -167 to +164
model = c.name if not model else model
model = model or c.name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function add_siepic_labels_and_simulation_info refactored with the following changes:

e = []
e.append(
e = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_mask2 refactored with the following changes:

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Apr 28, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.65 ⭐ 4.58 ⭐ -0.07 👍
Method Length 53.32 ⭐ 52.59 ⭐ -0.73 👍
Working memory 8.55 🙂 8.47 🙂 -0.08 👍
Quality 71.72% 🙂 72.05% 🙂 0.33% 👍
Other metrics Before After Change
Lines 391 383 -8
Changed files Quality Before Quality After Quality Change
install_tech.py 85.66% ⭐ 86.43% ⭐ 0.77% 👍
docs/report/splitter_length.py 91.56% ⭐ 92.66% ⭐ 1.10% 👍
ubcpdk/import_gds.py 60.92% 🙂 61.47% 🙂 0.55% 👍
ubcpdk/samples/test_ubc1.py 77.86% ⭐ 78.11% ⭐ 0.25% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
ubcpdk/import_gds.py add_ports_from_siepic_pins 14 🙂 183 😞 16 ⛔ 37.55% 😞 Try splitting into smaller methods. Extract out complex expressions
ubcpdk/import_gds.py add_ports 6 ⭐ 79 🙂 14 😞 59.45% 🙂 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!

@sonarcloud
Copy link

sonarcloud bot commented Apr 28, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #27 (9a132cb) into master (7e9ef65) will increase coverage by 0.18%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
+ Coverage   57.09%   57.28%   +0.18%     
==========================================
  Files          27       27              
  Lines         627      625       -2     
==========================================
  Hits          358      358              
+ Misses        269      267       -2     
Impacted Files Coverage Δ
ubcpdk/import_gds.py 51.68% <0.00%> (+1.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e9ef65...9a132cb. Read the comment docs.

@joamatab joamatab merged commit e2bbc15 into master May 2, 2022
@joamatab joamatab deleted the sourcery/master branch May 2, 2022 15:10
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

1 participant