Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Aug 8, 2020

Pull Request #102 refactored by Sourcery.

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

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:

Review changes via command line

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

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

@ghost ghost added the sourcery label Aug 8, 2020
@ghost ghost requested a review from Hellebore August 8, 2020 08:36

if False:
pass
pass
Copy link
Author

Choose a reason for hiding this comment

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

Lines 5-9 refactored with the following changes:

  • Remove redundant conditional (remove-redundant-if)

Comment on lines -13 to -20
if False:
pass

if x == None:
if x is None:
do_x()

return None
do_x()
Copy link
Author

Choose a reason for hiding this comment

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

Function function refactored with the following changes:

  • Remove redundant conditional (remove-redundant-if)
  • Remove unreachable code (remove-unreachable-code)
  • Use x is None rather than x == None (none-compare)

Comment on lines -24 to +16
if False:
pass
pass
Copy link
Author

Choose a reason for hiding this comment

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

Function func2 refactored with the following changes:

  • Remove redundant conditional (remove-redundant-if)

Comment on lines -30 to +38
a_var = 10
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
if cond1:
c_var = 30
if cond2:
print(a_var)
print(a_var)
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
b_var = 20
if cond1:
c_var = 30
a_var = 10
if cond2:
print(a_var)
print(a_var)
Copy link
Author

Choose a reason for hiding this comment

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

Function move_assign refactored with the following changes:

  • Move assignments closer to their usage (move-assign)

@ghost
Copy link
Author

ghost commented Aug 8, 2020

Sourcery Code Quality Report (beta)

✅  Merging this PR will increase code quality in the affected files by 0.18 out of 10.

Quality metrics Before After Change
Complexity 2.00 1.00 -1.00 🔵
Method Length 22.45 19.21 -3.24 🔵
Quality 9.25 9.43 0.18 🔵
Other metrics Before After Change
Lines 36 27 -9
Changed files Quality Before Quality After Quality Change
test.py 9.25 9.43 0.18 🔵

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

File Function Complexity Length Overall Recommendation

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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@Hellebore Hellebore closed this Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant