Conversation
| space = ' ' | ||
| fullname = firstname + space + lastname | ||
| return fullname | ||
| return firstname + space + lastname |
There was a problem hiding this comment.
Function generate_full_name refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| division = a / b | ||
| remainder = a % b | ||
| floor_division = a // b | ||
| floor_division, remainder = divmod(a, b) |
There was a problem hiding this comment.
Lines 33-124 refactored with the following changes:
- Move assignment closer to its usage within a block (
move-assign-in-block) - Simplify division expressions (
simplify-division) - Simplify binary operation (
bin-op-identity) - Simplify comparison to boolean [×3] (
simplify-boolean-comparison) - Simplify logical expression using De Morgan identities (
de-morgan) - Removes or propagates redundant boolean expressions [×2] (
remove-redundant-boolean)
This removes the following comments ( why? ):
# False
# False - because 3 > 2 is true, then not True gives False
# True
|
|
||
| language = 'Python' | ||
| first_three = language[0:3] # starts at zero index and up to 3 but not include 3 | ||
| first_three = language[:3] |
There was a problem hiding this comment.
Lines 65-237 refactored with the following changes:
- Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] [×2] (
remove-redundant-slice-index) - Replace call to format with f-string [×2] (
use-fstring-for-formatting) - Remove unnecessary calls to
str()from formatted values in f-strings [×2] (remove-str-from-fstring)
This removes the following comments ( why? ):
# starts at zero index and up to 3 but not include 3
#
| @@ -1,4 +1,4 @@ | |||
| empty_list = list() # this is an empty list, no item in the list | |||
| empty_list = [] | |||
There was a problem hiding this comment.
Lines 1-177 refactored with the following changes:
- Replace list() with [] (
list-literal) - Merge extend into list declaration [×3] (
merge-list-extend) - Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] [×2] (
remove-redundant-slice-index) - Merge append into list declaration (
merge-list-append) - Move assignment closer to its usage within a block [×2] (
move-assign-in-block)
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 |
There was a problem hiding this comment.
Function generate_full_name refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| for num in args: | ||
| total += num | ||
| return total | ||
| return sum(args) |
There was a problem hiding this comment.
Function add_numbers refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable) - Convert for loop into call to sum() (
sum-comprehension) - Simplify generator expression (
simplify-generator)
| for num in args: | ||
| total += num | ||
| return total | ||
| return sum(args) |
There was a problem hiding this comment.
Function add_numbers refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable) - Convert for loop into call to sum() (
sum-comprehension) - Simplify generator expression (
simplify-generator)
| 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) |
There was a problem hiding this comment.
Function post refactored with the following changes:
- Move assignments closer to their usage (
move-assign)
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.68%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
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! |
Branch
masterrefactored 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
masterbranch, then run:Help us improve this pull request!