btclib-org / btclib

btclib: a python3 library for 'bitcoin cryptography'
https://btclib.org
MIT License
100 stars 40 forks source link

cleaned up code #100

Closed fametrano closed 1 year ago

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.27 ⭐ 4.27 ⭐ 0.00
Method Length 92.38 🙂 92.40 🙂 0.02 👎
Working memory 8.03 🙂 8.03 🙂 0.00
Quality 65.87% 🙂 65.86% 🙂 -0.01% 👎
Other metrics Before After Change
Lines 2846 2833 -13
Changed files Quality Before Quality After Quality Change
btclib/hashes.py 85.52% ⭐ 85.49% ⭐ -0.03% 👎
btclib/bip32/bip32.py 65.51% 🙂 65.51% 🙂 0.00%
btclib/bip32/slip132.py 81.81% ⭐ 81.81% ⭐ 0.00%
btclib/block/block_header.py 74.17% 🙂 74.17% 🙂 0.00%
btclib/ec/curve_group_f.py 77.64% ⭐ 77.64% ⭐ 0.00%
btclib/ecc/borromean.py 45.27% 😞 45.24% 😞 -0.03% 👎
btclib/mnemonic/entropy.py 62.80% 🙂 62.79% 🙂 -0.01% 👎
btclib/script/sig_hash.py 48.74% 😞 48.71% 😞 -0.03% 👎
tests/test_b32.py 80.22% ⭐ 80.22% ⭐ 0.00%
tests/test_b58.py 69.29% 🙂 69.29% 🙂 0.00%
tests/bip32/test_slip132.py 56.30% 🙂 56.30% 🙂 0.00%
tests/script/test_script_pub_key.py 69.36% 🙂 69.36% 🙂 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
btclib/ecc/borromean.py sign 18 🙂 338 ⛔ 20 ⛔ 23.44% ⛔ Try splitting into smaller methods. Extract out complex expressions
btclib/script/sig_hash.py taproot 13 🙂 314 ⛔ 18 ⛔ 29.54% 😞 Try splitting into smaller methods. Extract out complex expressions
btclib/bip32/bip32.py BIP32KeyData.assert_valid 21 😞 304 ⛔ 11 😞 32.58% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
btclib/mnemonic/entropy.py collect_rolls 21 😞 207 ⛔ 13 😞 34.09% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
btclib/script/sig_hash.py legacy 18 🙂 192 😞 11 😞 40.70% 😞 Try splitting into smaller methods. Extract out complex expressions

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!