hikariatama / Hikka

The most fresh and updateable developer-oriented Telegram userbot
https://hikka.pw
GNU Affero General Public License v3.0
323 stars 527 forks source link

Remove adware (Sourcery refactored) #81

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

Pull Request #80 refactored by Sourcery.

Since the original Pull Request was opened as a fork in a contributor's repository, we are unable to create a Pull Request branching from it.

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to the original Pull Request

    Incorporate changes via command line
    git fetch https://github.com/hikariatama/Hikka pull/80/head
    git merge --ff-only FETCH_HEAD
    git push

NOTE: As code is pushed to the original Pull Request, Sourcery will re-run and update (force-push) this Pull Request with new refactorings as necessary. If Sourcery finds no refactorings at any point, this Pull Request will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Help us improve this pull request!

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 29.46 😞 29.47 😞 0.01 👎
Method Length 93.59 🙂 93.03 🙂 -0.56 👍
Working memory 6.41 🙂 6.46 🙂 0.05 👎
Quality 49.19% 😞 48.81% 😞 -0.38% 👎
Other metrics Before After Change
Lines 4140 4071 -69
Changed files Quality Before Quality After Quality Change
hikka/loader.py 48.51% 😞 48.82% 😞 0.31% 👍
hikka/types.py 81.17% ⭐ 81.49% ⭐ 0.32% 👍
hikka/modules/hikka_settings.py 50.67% 🙂 48.54% 😞 -2.13% 👎
hikka/modules/loader.py 33.46% 😞 32.30% 😞 -1.16% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
hikka/modules/loader.py LoaderMod.load_module 146 ⛔ 1890 ⛔ 0.02% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
hikka/loader.py Modules._mod_import_lib 49 ⛔ 808 ⛔ 5.06% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
hikka/loader.py replace_all_refs 67 ⛔ 317 ⛔ 6.20% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
hikka/modules/hikka_settings.py HikkaSettingsMod.invoke 19 😞 450 ⛔ 20 ⛔ 21.08% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
hikka/loader.py translatable_docstring 27 😞 289 ⛔ 22.31% ⛔ Refactor to reduce nesting. Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

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!