Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot commented Jul 23, 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 rririanto July 23, 2022 20:43
Comment thread mymodule.py
space = ' '
fullname = firstname + space + lastname
return fullname
return firstname + space + lastname
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function generate_full_name refactored with the following changes:

Comment thread 03_Day_Operators/day-3.py
division = a / b
remainder = a % b
floor_division = a // b
floor_division, remainder = divmod(a, b)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 33-124 refactored with the following changes:

This removes the following comments ( why? ):

# False
# False - because 3 > 2 is true, then not True gives False
# True

Comment thread 04_Day_Strings/day_4.py

language = 'Python'
first_three = language[0:3] # starts at zero index and up to 3 but not include 3
first_three = language[:3]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 65-237 refactored with the following changes:

This removes the following comments ( why? ):

# starts at zero index and up to 3 but not include 3
#

Comment thread 05_Day_Lists/day_5.py
@@ -1,4 +1,4 @@
empty_list = list() # this is an empty list, no item in the list
empty_list = []
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 1-177 refactored with the following changes:

This removes the following comments ( why? ):

# if we don't set where to stop it takes all the rest
# this is an empty list, no item in the list
# join with extend
# it returns all the fruits

space = ' '
fullname = firstname + space + lastname
return fullname
return firstname + space + lastname
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function generate_full_name refactored with the following changes:

for num in args:
total += num
return total
return sum(args)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function add_numbers refactored with the following changes:

Comment thread mypackage/arithmetics.py
for num in args:
total += num
return total
return sum(args)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function add_numbers refactored with the following changes:

Comment thread python_for_web/app.py
Comment on lines -28 to +30
name = 'Text Analyzer'
if request.method == 'GET':
return render_template('post.html', name = name, title = name)
name = 'Text Analyzer'
return render_template('post.html', name = name, title = name)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function post refactored with the following changes:

@sourcery-ai
Copy link
Copy Markdown
Author

sourcery-ai Bot commented Jul 23, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 1.73 ⭐ 1.74 ⭐ 0.01 👎
Method Length 89.15 🙂 87.52 🙂 -1.63 👍
Working memory 8.47 🙂 8.57 🙂 0.10 👎
Quality 56.46% 🙂 55.78% 🙂 -0.68% 👎
Other metrics Before After Change
Lines 633 619 -14
Changed files Quality Before Quality After Quality Change
mymodule.py 97.67% ⭐ 98.15% ⭐ 0.48% 👍
03_Day_Operators/day-3.py 44.19% 😞 44.22% 😞 0.03% 👍
04_Day_Strings/day_4.py 47.90% 😞 47.90% 😞 0.00%
05_Day_Lists/day_5.py 54.04% 🙂 54.05% 🙂 0.01% 👍
12_Day_Modules/mymodule.py 97.67% ⭐ 98.15% ⭐ 0.48% 👍
20_Day_Python_package_manager/arithmetic.py 99.22% ⭐ 99.86% ⭐ 0.64% 👍
mypackage/arithmetics.py 99.22% ⭐ 99.86% ⭐ 0.64% 👍
python_for_web/app.py 92.31% ⭐ 92.31% ⭐ 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation

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!

Repository owner deleted a comment from DylanZhu2021 Feb 23, 2024
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