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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jul 6, 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 Jped July 6, 2022 16:34
next_repo = r.spop("github_repos")
while next_repo:
while next_repo := r.spop("github_repos"):
Copy link
Author

Choose a reason for hiding this comment

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

Function prepare refactored with the following changes:

Comment on lines -66 to +64
elif resp.status_code == 404:
pass
else:
elif resp.status_code != 404:
Copy link
Author

Choose a reason for hiding this comment

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

Function get_email refactored with the following changes:

Comment on lines -85 to +81
profile = r.spop("finished_profiles")
while profile:
while profile := r.spop("finished_profiles"):
Copy link
Author

Choose a reason for hiding this comment

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

Function clean_redis_set refactored with the following changes:

Comment on lines -128 to +122
"insert into github_leads (source_file, source_repo, gh_login, gh_id, gh_name, gh_email, gh_twitter, gh_public_repos, gh_followers, gh_created_at, gh_updated_at, raw) values ('{}', '{}', '{}', '{}', '{}', '{}', '{}', {}, {}, '{}', '{}', '{}')".format(
source_file,
source_repo,
gh_login,
gh_id,
gh_name,
gh_email,
gh_twitter,
gh_public_repos,
gh_followers,
gh_created_at,
gh_updated_at,
raw,
)
f"insert into github_leads (source_file, source_repo, gh_login, gh_id, gh_name, gh_email, gh_twitter, gh_public_repos, gh_followers, gh_created_at, gh_updated_at, raw) values ('{source_file}', '{source_repo}', '{gh_login}', '{gh_id}', '{gh_name}', '{gh_email}', '{gh_twitter}', {gh_public_repos}, {gh_followers}, '{gh_created_at}', '{gh_updated_at}', '{raw}')"
Copy link
Author

Choose a reason for hiding this comment

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

Function _create_new_lead refactored with the following changes:

Comment on lines -146 to +128
url = "https://api.github.com/repos/{}/stargazers?per_page=100&page={}".format(
repo, page
)
url = f"https://api.github.com/repos/{repo}/stargazers?per_page=100&page={page}"

Copy link
Author

Choose a reason for hiding this comment

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

Function _get_star_gazers refactored with the following changes:

Comment on lines -176 to +156
github_repo_name = "{}/{}".format(main_name.split("_")[0], main_name.split("_")[1])
return github_repo_name
return f'{main_name.split("_")[0]}/{main_name.split("_")[1]}'
Copy link
Author

Choose a reason for hiding this comment

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

Function _get_repo refactored with the following changes:

Comment on lines -180 to +159
if __name__ == "__main__":
pass
pass
Copy link
Author

Choose a reason for hiding this comment

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

Lines 180-181 refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Jul 6, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 6.12 ⭐ 6.01 ⭐ -0.11 👍
Method Length 81.29 🙂 82.00 🙂 0.71 👎
Working memory 11.08 😞 11.79 😞 0.71 👎
Quality 60.31% 🙂 59.06% 🙂 -1.25% 👎
Other metrics Before After Change
Lines 159 137 -22
Changed files Quality Before Quality After Quality Change
tasks/get_email.py 60.31% 🙂 59.06% 🙂 -1.25% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
tasks/get_email.py get_email 10 🙂 148 😞 12 😞 49.79% 😞 Try splitting into smaller methods. Extract out complex expressions
tasks/get_email.py clean_redis_set 3 ⭐ 142 😞 17 ⛔ 50.81% 🙂 Try splitting into smaller methods. Extract out complex expressions
tasks/get_email.py _get_star_gazers 6 ⭐ 93 🙂 12 😞 60.41% 🙂 Extract out complex expressions
tasks/get_email.py _create_new_lead 0 ⭐ 70 🙂 19 ⛔ 61.74% 🙂 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!

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