btclib-org / btclib

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

Add taproot psbt fields #107

Closed giacomocaironi 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 1.94%.

Quality metrics Before After Change
Complexity 3.17 ⭐ 4.15 ⭐ 0.98 👎
Method Length 85.84 🙂 83.17 🙂 -2.67 👍
Working memory 8.38 🙂 9.91 😞 1.53 👎
Quality 68.82% 🙂 66.88% 🙂 -1.94% 👎
Other metrics Before After Change
Lines 1419 1758 339
Changed files Quality Before Quality After Quality Change
btclib/psbt/psbt_in.py 56.77% 🙂 48.59% 😞 -8.18% 👎
btclib/psbt/psbt_out.py 75.68% ⭐ 64.78% 🙂 -10.90% 👎
btclib/psbt/psbt_utils.py 81.82% ⭐ 84.01% ⭐ 2.19% 👍
btclib/script/taproot.py 64.83% 🙂 65.78% 🙂 0.95% 👍
tests/psbt/test_psbt.py 71.98% 🙂 71.55% 🙂 -0.43% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
btclib/psbt/psbt_in.py PsbtIn.parse 22 😞 394 ⛔ 45 ⛔ 15.54% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
btclib/psbt/psbt_in.py PsbtIn.serialize 28 😞 367 ⛔ 7 🙂 35.32% 😞 Refactor to reduce nesting. Try splitting into smaller methods
btclib/psbt/psbt_in.py PsbtIn.__init__ 1 ⭐ 217 ⛔ 26 ⛔ 41.44% 😞 Try splitting into smaller methods. Extract out complex expressions
btclib/psbt/psbt_out.py PsbtOut.parse 9 🙂 150 😞 19 ⛔ 42.52% 😞 Try splitting into smaller methods. Extract out complex expressions
btclib/script/taproot.py check_output_pubkey 8 ⭐ 212 ⛔ 11 😞 47.79% 😞 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!