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 main branch #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Sourcery refactored main branch #13

wants to merge 1 commit into from

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Feb 16, 2022

Branch main 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 main branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from kayhayen February 16, 2022 10:11
Comment on lines 639 to -649

contents = open(infile).read()

new_contents = contents.split(
"""<img alt="images/Nuitka-Logo-Symbol.png" src="images/Nuitka-Logo-Symbol.png">""",
1
)
new_contents = "".join( new_contents )

if contents != new_contents:
open(infile,"w").write(new_contents)
Copy link
Author

Choose a reason for hiding this comment

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

Function hackContentClasses refactored with the following changes:

Comment on lines +150 to +166
if not os.path.exists(filename):
return None
# There was a bug, where Scons output was done even if used --quiet.
code = "".join(
line for line in open(filename, "r")
if "Nuitka-Scons:" not in line
)

try:
exec(code, values)
except ValueError:
return None
values = {}

del values["__builtins__"]
return values
else:
try:
exec(code, values)
except ValueError:
return None

del values["__builtins__"]
return values
Copy link
Author

Choose a reason for hiding this comment

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

Function readDataFile refactored with the following changes:

Comment on lines -662 to +661
case_name = filename[:-5] + ".py"
case_name = f'{filename[:-5]}.py'
Copy link
Author

Choose a reason for hiding this comment

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

Function _updateNumbers refactored with the following changes:

Comment on lines -769 to +768
assert 0 == os.system("nikola " + command)
assert 0 == os.system(f'nikola {command}')
Copy link
Author

Choose a reason for hiding this comment

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

Function main.runNikolaCommand refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Feb 16, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 25.19 😞 25.45 😞 0.26 👎
Method Length 82.00 🙂 80.97 🙂 -1.03 👍
Working memory 10.74 😞 10.72 😞 -0.02 👍
Quality 47.73% 😞 47.54% 😞 -0.19% 👎
Other metrics Before After Change
Lines 1967 1955 -12
Changed files Quality Before Quality After Quality Change
conf.py 73.01% 🙂 72.45% 🙂 -0.56% 👎
update.py 41.72% 😞 42.01% 😞 0.29% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
update.py updateConstructGraphs 65 ⛔ 720 ⛔ 16 ⛔ 8.78% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
update.py _updateNumbers 40 ⛔ 412.99 ⛔ 18 ⛔ 12.25% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
update.py main 11 🙂 199.99 😞 9 🙂 49.85% 😞 Try splitting into smaller methods

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!

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.

0 participants