Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Sourcery refactored master branch #6

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented May 18, 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 j1g5awi May 18, 2022 06:32
Comment on lines +26 to +37
elif reverse:
for type_b in conv:
for id_b in conv[type_b]:
for type_a in self.__conv_mapping:
for id_a in self.__conv_mapping[type_a]:
if id_b in self.__conv_mapping[type_a][id_a][type_b]:
tmp_conv_mapping[type_a].append(id_a)
else:
if reverse:
for type_b in conv:
for id_b in conv[type_b]:
for type_a in self.__conv_mapping:
for id_a in self.__conv_mapping[type_a]:
if id_b in self.__conv_mapping[type_a][id_a][type_b]:
tmp_conv_mapping[type_a].append(id_a)
else:
for type_a in conv:
for id_a in conv[type_a]:
if id_a in self.__conv_mapping[type_a]:
tmp_conv_mapping = self.__conv_mapping[type_a][id_a]
for type_a in conv:
for id_a in conv[type_a]:
if id_a in self.__conv_mapping[type_a]:
tmp_conv_mapping = self.__conv_mapping[type_a][id_a]
Copy link
Author

Choose a reason for hiding this comment

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

Function ConvMapping.get_conv refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented May 18, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 26.71 😞 24.60 😞 -2.11 👍
Method Length 66.50 🙂 66.50 🙂 0.00
Working memory 8.24 🙂 8.21 🙂 -0.03 👍
Quality 53.60% 🙂 54.31% 🙂 0.71% 👍
Other metrics Before After Change
Lines 127 126 -1
Changed files Quality Before Quality After Quality Change
nonebot_plugin_puppet/mapping.py 53.60% 🙂 54.31% 🙂 0.71% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
nonebot_plugin_puppet/mapping.py ConvMapping.link_conv 34 ⛔ 158 😞 9 🙂 38.49% 😞 Refactor to reduce nesting. Try splitting into smaller methods
nonebot_plugin_puppet/mapping.py ConvMapping.unlink_conv 34 ⛔ 158 😞 9 🙂 38.49% 😞 Refactor to reduce nesting. Try splitting into smaller methods
nonebot_plugin_puppet/mapping.py ConvMapping.get_conv 37 ⛔ 107 🙂 11 😞 39.36% 😞 Refactor to reduce nesting. Extract out complex expressions
nonebot_plugin_puppet/mapping.py ConvMapping.__remove_conv 21 😞 81 🙂 8 🙂 57.37% 🙂 Refactor to reduce nesting

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!

@j1g5awi
Copy link
Member

j1g5awi commented May 18, 2022

Shit Refactor

@j1g5awi j1g5awi closed this May 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant