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 (Sourcery refactored) #108

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

Pull Request #107 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/btclib-org/btclib pull/107/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 1.92%.

Quality metrics Before After Change
Complexity 3.17 ⭐ 4.15 ⭐ 0.98 👎
Method Length 85.84 🙂 83.11 🙂 -2.73 👍
Working memory 8.38 🙂 9.90 😞 1.52 👎
Quality 68.82% 🙂 66.90% 🙂 -1.92% 👎
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.17% ⭐ 2.35% 👍
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!