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

Sourcery refactored dev branch #19

Merged
merged 1 commit into from
Mar 18, 2021
Merged

Sourcery refactored dev branch #19

merged 1 commit into from
Mar 18, 2021

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Mar 18, 2021

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:

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

@sourcery-ai sourcery-ai bot requested a review from EndlessTrax March 18, 2021 15:58
if verbose is True:
if verbose:
Copy link
Author

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:

Comment on lines -65 to +67
if sitemap is True:
if sitemap:
set_of_urls = set()
results = dict()
results = {}
Copy link
Author

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:

if url.endswith("/"):
self.base_url = url
else:
self.base_url = url + "/"

self.base_url = url if url.endswith("/") else url + "/"
Copy link
Author

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:

Comment on lines -102 to +98
results = dict()
results = {}
Copy link
Author

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:

Comment on lines -142 to +144
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:
Copy link
Author

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:

Comment on lines -176 to +171
return_dict = dict()
return_dict = {}
Copy link
Author

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:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Mar 18, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 1.47%.

Quality metrics Before After Change
Complexity 10.25 🙂 9.61 🙂 -0.64 👍
Method Length 44.40 ⭐ 42.40 ⭐ -2.00 👍
Working memory 9.12 🙂 8.82 🙂 -0.30 👍
Quality 65.44% 🙂 66.91% 🙂 1.47% 👍
Other metrics Before After Change
Lines 260 254 -6
Changed files Quality Before Quality After Quality Change
pyanchor/cli.py 51.12% 🙂 53.40% 🙂 2.28% 👍
pyanchor/link_checker.py 76.81% ⭐ 78.32% ⭐ 1.51% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
pyanchor/cli.py main 15 🙂 144 😞 12 😞 45.87% 😞 Try splitting into smaller methods. Extract out complex expressions
pyanchor/cli.py print_results 18 🙂 99 🙂 13 😞 47.51% 😞 Extract out complex expressions
pyanchor/link_checker.py LinkResults.check_link_for_http_scheme 5 ⭐ 62 🙂 10 😞 69.63% 🙂 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!

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

@codecov
Copy link

codecov bot commented Mar 18, 2021

Codecov Report

Merging #19 (5045b95) into dev (ac7d4bd) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
pyanchor/cli.py 98.18% <100.00%> (-0.04%) ⬇️
pyanchor/link_checker.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac7d4bd...5045b95. Read the comment docs.

@EndlessTrax EndlessTrax merged commit 645b840 into dev Mar 18, 2021
@EndlessTrax EndlessTrax deleted the sourcery/dev branch June 2, 2021 19:21
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.

None yet

1 participant