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

Performance improvements in __main__.py #209

Merged
merged 3 commits into from
Oct 2, 2021
Merged

Conversation

rogalski
Copy link
Contributor

@rogalski rogalski commented Sep 29, 2021

Do not recompute invariant values in bisect loop.

Fixes #210.

Do not recompute invariant values in bisect loop.
@akaihola akaihola self-requested a review September 30, 2021 19:07
@akaihola
Copy link
Owner

@rogalski, there seem to be a couple of unfortunate trailing whitespaces. See the build error.

Copy link
Owner

@akaihola akaihola left a comment

Choose a reason for hiding this comment

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

Could you add a change log entry, and remove the trailing whitespaces caught by the CI build?

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 30, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 16.67 🙂 16.82 🙂 0.15 👎
Method Length 101.22 🙂 101.78 🙂 0.56 👎
Working memory 13.48 😞 13.55 😞 0.07 👎
Quality 42.23% 😞 41.84% 😞 -0.39% 👎
Other metrics Before After Change
Lines 372 376 4
Changed files Quality Before Quality After Quality Change
src/darker/main.py 42.23% 😞 41.84% 😞 -0.39% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
src/darker/main.py main 29 😞 365 ⛔ 15 😞 20.34% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/darker/main.py _reformat_single_file 11 🙂 204 😞 18 ⛔ 36.64% 😞 Try splitting into smaller methods. Extract out complex expressions
src/darker/main.py format_edited_parts 10 🙂 84 🙂 11 😞 59.66% 🙂 Extract out complex expressions
src/darker/main.py print_diff 6 ⭐ 90 🙂 10 😞 64.47% 🙂 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!

@akaihola akaihola merged commit abb9c7f into akaihola:master Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Loop invariant code slows down bisection when AST verification fails
2 participants