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 #3

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 16, 2020

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^

@height
Copy link

height bot commented Jul 16, 2020

Link Height tasks by mentioning a task ID in the pull request title or description, commit messages, or comments.

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

Comment on lines -55 to +64
params = {}
params['userId'] = userId
params['labelIds'] = labelIds
params['q'] = q
params['pageToken'] = pageToken
params['maxResults'] = maxResults
params['includeSpamTrash'] = includeSpamTrash
params['fields'] = fields
params = {
'userId': userId,
'labelIds': labelIds,
'q': q,
'pageToken': pageToken,
'maxResults': maxResults,
'includeSpamTrash': includeSpamTrash,
'fields': fields,
}

Copy link
Author

Choose a reason for hiding this comment

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

Function GmailApp.searchMessages refactored with the following changes:

  • Merge dictionary assignment with declaration (merge-dict-assign)

Comment on lines -75 to +77
body = {}
body['ids'] = ids
body = {'ids': ids}
Copy link
Author

Choose a reason for hiding this comment

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

Function GmailApp.deleteMessages refactored with the following changes:

  • Merge dictionary assignment with declaration (merge-dict-assign)

Comment on lines -128 to +131
logging.info('Done.')
else:
logging.info(args.server + ' not found.')
logging.info('Done.')

logging.info('Done.')
Copy link
Author

Choose a reason for hiding this comment

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

Lines 128-131 refactored with the following changes:

  • Hoist repeated code outside conditional statement (hoist-statement-from-if)

Comment on lines -155 to +164
if ask == 'y' or ask == 'Y' or ask == 'yes':
if ask in ['y', 'Y', 'yes']:
DOCKER_HUB_USERNAME = input('Username ? ')
DOCKER_HUB_PASSWORD = input('Password ? ')
else:
return 'undefined (Private repository ?)'

r = get_request(url, jwt_auth=True, token=get_docker_token())
if 'results' not in r:
logging.error('Invalid password or username, by pass')
return 'undefined'
if 'results' not in r:
logging.error('Invalid password or username, by pass')
return 'undefined'
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_last_tag refactored with the following changes:

  • Hoist conditional out of nested conditional (hoist-if-from-if)
  • Replace multiple comparisons of same variable with in operator (merge-comparisons)

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Jul 16, 2020

Sourcery Code Quality Report (beta)

✅ Merging this PR will increase code quality in the affected files by 0.05 out of 10.

Before After Change
Quality 8.05 8.1 0.05
Complexity 3.68 3.59 -0.09
Method Length 68.67 66.81 -1.86
Lines 484 485 1
Changed files Quality Before Quality After Quality Change
gmailApp/gmail_client.py 8.85 8.97 0.12 ⬆️
kimsufi/verify-server-availabilty-kimsufi.py 7.58 7.61 0.03 ⬆️
rancher-services-check-updates/main.py 7.81 7.83 0.02 ⬆️

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

File Function Quality Recommendation
rancher-services-check-updates/main.py get_rancher_services_list 5.98 Split out functionality

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 via email or our Gitter!

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

0 participants