Skip to content

Sourcery refactored master branch - #16

Open
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master
Open

Sourcery refactored master branch#16
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Jun 30, 2020

Copy link
Copy Markdown

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^

Comment thread opentfd.py
await asyncio.sleep(1)
while time() - start_time <= 60:
for i in range(lines_max):
for _ in range(lines_max):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function run_command_shell refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)
  • Simplify logical expression using De Morgan identities (de-morgan)

Comment thread opentfd.py
if text.endswith('/{0}'.format(lang_code)):
translated = mtranslate.translate(text[:-(len(lang_code) + 1)], lang_code, 'auto')
for i in range(3):
for _ in range(3):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function translator refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

Comment thread opentfd.py
Comment on lines -139 to +140
if event.chat:
if event.chat.bot:
return
if event.chat and event.chat.bot:
return

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function break_updater refactored with the following changes:

  • Merge nested if conditions (merge-nested-ifs)

Comment thread opentfd.py
Comment on lines -172 to -178
if event.text:
if event.text.startswith('!bash'):
return
if event.text and event.text.startswith('!bash'):
return
with suppress(Exception):
if event.chat:
if event.chat.bot:
return

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function merger refactored with the following changes:

  • Merge nested if conditions (merge-nested-ifs)

@sourcery-ai

sourcery-ai Bot commented Jun 30, 2020

Copy link
Copy Markdown
Author

Sourcery Code Quality Report (beta)

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

Before After Change
Quality 6.89 6.93 0.04
Complexity 10.0 9.62 -0.38
Method Length 95.54 95.29 -0.25
Lines 196 193 -3
Changed files Quality Before Quality After Quality Change
opentfd.py 6.89 6.93 0.04 ⬆️

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

File Function Quality Recommendation
opentfd.py run_command_shell 4.62 Split out functionality
opentfd.py merger 5.42 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.

1 participant