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 master branch #1

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jul 10, 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!


Copy link
Author

Choose a reason for hiding this comment

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

Found the following improvement in Function QueryNotifyPrint.finish:


Copy link
Author

Choose a reason for hiding this comment

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

Function QueryNotifyPrint.update refactored with the following changes:

Comment on lines -284 to +305

title = "End"

print('\r') # An empty line between last line of main output and last line(more clear output)
print(Style.BRIGHT + Fore.GREEN + "[" +
Fore.YELLOW + "!" +
Fore.GREEN + f"] {title}" +
Fore.GREEN + ": " +
Fore.WHITE + f" {message}" )

Copy link
Author

Choose a reason for hiding this comment

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

Found the following improvement in Function QueryNotifyPrint.finish:

allUsernames = []
for i in checksymbols:
allUsernames.append(username.replace("{?}", i))
return allUsernames
return [username.replace("{?}", i) for i in checksymbols]
Copy link
Author

Choose a reason for hiding this comment

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

Function MultipleUsernames refactored with the following changes:

Comment on lines -211 to +208
if len(site_data) >= 20:
max_workers = 20
else:
max_workers = len(site_data)

max_workers = min(len(site_data), 20)
Copy link
Author

Choose a reason for hiding this comment

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

Function sherlock refactored with the following changes:

This removes the following comments ( why? ):

# Site forwards request to a different URL if username not
# The final result of the request will be what is available.
# found.  Disallow the redirect so we can capture the
# Allow whatever redirect that the site wants to do.
# Checks if the status code of the response is 2XX
# http status from the original URL request.

site_data_all = {}
for site in sites:
site_data_all[site.name] = site.information
site_data_all = {site.name: site.information for site in sites}
Copy link
Author

Choose a reason for hiding this comment

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

Function SherlockBaseTest.setUp refactored with the following changes:

Comment on lines -170 to +172
(site in self.excluded_sites) or
(site_data["errorType"] != detect_type) or
(site_data.get("username_claimed") is None) or
(site_data.get("username_unclaimed") is None)
):
# This is either not a site we are interested in, or the
# site does not contain the required information to do
# the tests.
pass
else:
site not in self.excluded_sites
and site_data["errorType"] == detect_type
and site_data.get("username_claimed") is not None
and site_data.get("username_unclaimed") is not None
):
Copy link
Author

Choose a reason for hiding this comment

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

Function SherlockBaseTest.detect_type_check refactored with the following changes:

This removes the following comments ( why? ):

# the tests.
# site does not contain the required information to do
# This is either not a site we are interested in, or the

Comment on lines -216 to -224
site_no_tests_list = []

for site, site_data in self.site_data_all.items():
site_no_tests_list = [
site
for site, site_data in self.site_data_all.items()
if (
(site_data.get("username_claimed") is None) or
(site_data.get("username_unclaimed") is None)
):
# Test information not available on this site.
site_no_tests_list.append(site)
Copy link
Author

Choose a reason for hiding this comment

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

Function SherlockBaseTest.coverage_total_check refactored with the following changes:

This removes the following comments ( why? ):

# Test information not available on this site.

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Jul 10, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 49.51 ⛔ 47.94 ⛔ -1.57 👍
Method Length 93.10 🙂 92.03 🙂 -1.07 👍
Working memory 15.83 ⛔ 15.92 ⛔ 0.09 👎
Quality 34.05% 😞 33.53% 😞 -0.52% 👎
Other metrics Before After Change
Lines 1239 1224 -15
Changed files Quality Before Quality After Quality Change
sherlock/notify.py 66.58% 🙂 66.60% 🙂 0.02% 👍
sherlock/sherlock.py 21.53% ⛔ 21.25% ⛔ -0.28% 👎
sherlock/tests/base.py 66.97% 🙂 66.22% 🙂 -0.75% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
sherlock/sherlock.py sherlock 89 ⛔ 580 ⛔ 27 ⛔ 1.94% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
sherlock/sherlock.py main 73 ⛔ 939 ⛔ 16 ⛔ 8.23% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
sherlock/notify.py QueryNotifyPrint.update 13 🙂 257 ⛔ 23 ⛔ 28.76% 😞 Try splitting into smaller methods. Extract out complex expressions
sherlock/tests/base.py SherlockBaseTest.username_check 9 🙂 113 🙂 16 ⛔ 49.49% 😞 Extract out complex expressions
sherlock/tests/base.py SherlockBaseTest.detect_type_check 13 🙂 90 🙂 12 😞 54.39% 🙂 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!

Help us improve this quality report!

@annihilatorrrr annihilatorrrr deleted the sourcery/master branch July 10, 2022 14:10
pull bot pushed a commit that referenced this pull request Sep 23, 2022
pull bot pushed a commit that referenced this pull request Dec 28, 2022
added browse functionality to notify.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant