zverok / spylls

Pure Python spell-checker, (almost) full port of Hunspell
https://spylls.readthedocs.io
Mozilla Public License 2.0
285 stars 21 forks source link

Sourcery refactored master branch #1

Closed sourcery-ai[bot] closed 3 years ago

sourcery-ai[bot] commented 3 years ago

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^
sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 9.65 🙂 9.18 🙂 -0.47 👍
Method Length 62.80 🙂 62.20 🙂 -0.60 👍
Working memory 8.84 🙂 8.78 🙂 -0.06 👍
Quality 63.73% 🙂 64.22% 🙂 0.49% 👍
Other metrics Before After Change
Lines 1008 1004 -4
Changed files Quality Before Quality After Quality Change
spylls/hunspell/algo/capitalization.py 77.43% ⭐ 77.62% ⭐ 0.19% 👍
spylls/hunspell/algo/ngram_suggest.py 50.81% 🙂 50.83% 🙂 0.02% 👍
spylls/hunspell/algo/permutations.py 65.61% 🙂 67.39% 🙂 1.78% 👍
spylls/hunspell/algo/string_metrics.py 55.28% 🙂 55.32% 🙂 0.04% 👍
spylls/hunspell/algo/trie.py 86.83% ⭐ 88.89% ⭐ 2.06% 👍
tests/integrational/test_suggest.py 61.17% 🙂 61.29% 🙂 0.12% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
spylls/hunspell/algo/ngram_suggest.py ngram_suggest 27 😞 218 ⛔ 15 😞 26.94% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
tests/integrational/test_suggest.py report 15 🙂 208 ⛔ 13 😞 38.56% 😞 Try splitting into smaller methods. Extract out complex expressions
spylls/hunspell/algo/string_metrics.py ngram 20 😞 126 😞 13 😞 42.54% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
spylls/hunspell/algo/ngram_suggest.py forms_for 10 🙂 177 😞 15 😞 42.71% 😞 Try splitting into smaller methods. Extract out complex expressions
spylls/hunspell/algo/permutations.py mapchars 26 😞 89 🙂 7 🙂 55.40% 🙂 Refactor to reduce nesting

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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.