SAGIRI-kawaii / sagiri-bot

基于Graia Ariadne和Mirai的QQ机器人 SAGIRI-BOT
GNU Affero General Public License v3.0
697 stars 83 forks source link

让 Type check 高兴的小魔法 #384

Closed I-love-study closed 1 year ago

I-love-study commented 1 year ago
  1. black 格式化 pica
  2. 把 pyproject.toml 的 "^" 全换成 ">="
  3. 尝试让 type check 不要在那乱叫
  4. 添加absolute()来保证进行绝对路径比较 (Path(__file__).parent的返回值在linux中可能是-
sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 3.17 ⭐ 3.12 ⭐ -0.05 👍
Method Length 80.86 🙂 78.69 🙂 -2.17 👍
Working memory 7.84 🙂 7.92 🙂 0.08 👎
Quality 69.56% 🙂 69.45% 🙂 -0.11% 👎
Other metrics Before After Change
Lines 796 858 62
Changed files Quality Before Quality After Quality Change
main.py 77.97% ⭐ 77.23% ⭐ -0.74% 👎
modules/self_contained/pica/__init__.py 52.55% 🙂 52.17% 🙂 -0.38% 👎
modules/self_contained/pica/model.py 71.88% 🙂 71.74% 🙂 -0.14% 👎
modules/self_contained/pica/pica.py 81.85% ⭐ 81.85% ⭐ 0.00%
modules/self_contained/pica/utils.py 64.88% 🙂 64.64% 🙂 -0.24% 👎
shared/utils/module_related.py 84.37% ⭐ 85.42% ⭐ 1.05% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
modules/self_contained/pica/__init__.py pica_download 7 ⭐ 371 ⛔ 17 ⛔ 34.60% 😞 Try splitting into smaller methods. Extract out complex expressions
modules/self_contained/pica/model.py Comic.get_episodes 10 🙂 210 ⛔ 12 😞 44.34% 😞 Try splitting into smaller methods. Extract out complex expressions
modules/self_contained/pica/__init__.py pica_search 8 ⭐ 220 ⛔ 10 😞 49.16% 😞 Try splitting into smaller methods. Extract out complex expressions
modules/self_contained/pica/model.py Image.get 10 🙂 157 😞 9 🙂 54.54% 🙂 Try splitting into smaller methods
modules/self_contained/pica/utils.py pica_t2i 7 ⭐ 169 😞 9 🙂 56.19% 🙂 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!