-
-
Notifications
You must be signed in to change notification settings - Fork 7
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 dev branch #19
Conversation
if verbose is True: | ||
if verbose: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function print_results
refactored with the following changes:
- Simplify comparison to boolean (
simplify-boolean-comparison
)
if sitemap is True: | ||
if sitemap: | ||
set_of_urls = set() | ||
results = dict() | ||
results = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function main
refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if
) - Replace assignment with augmented assignment (
aug-assign
) - Replace list() with [] (
list-literal
) - Replace dict() with {} (
dict-literal
) - Simplify comparison to boolean (
simplify-boolean-comparison
)
if url.endswith("/"): | ||
self.base_url = url | ||
else: | ||
self.base_url = url + "/" | ||
|
||
self.base_url = url if url.endswith("/") else url + "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function AllTags.__init__
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
)
results = dict() | ||
results = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function LinkResults.build_results_dictionary
refactored with the following changes:
- Replace dict() with {} (
dict-literal
)
return_dict = dict() | ||
return_dict = {} | ||
for link in links: | ||
obs_link_attrs = [] | ||
for attribute in OBSOLETE_ATTRS: | ||
if link.get(attribute): | ||
obs_link_attrs.append(attribute) | ||
obs_link_attrs = [ | ||
attribute for attribute in OBSOLETE_ATTRS if link.get(attribute) | ||
] | ||
|
||
if len(obs_link_attrs) > 0: | ||
if obs_link_attrs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function LinkAnalysis.obsolete_attributes
refactored with the following changes:
- Replace dict() with {} (
dict-literal
) - Simplify sequence comparison (
simplify-len-comparison
) - Convert for loop into list comprehension (
list-comprehension
)
return_dict = dict() | ||
return_dict = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function LinkAnalysis.unsafe_attributes
refactored with the following changes:
- Replace dict() with {} (
dict-literal
)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 1.47%.
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! Let us know what you think of it by mentioning @sourcery-ai in a comment. |
Codecov Report
@@ Coverage Diff @@
## dev #19 +/- ##
==========================================
- Coverage 99.23% 99.19% -0.04%
==========================================
Files 3 3
Lines 130 124 -6
==========================================
- Hits 129 123 -6
Misses 1 1
Continue to review full report at Codecov.
|
Branch
dev
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
dev
branch, then run: