Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy for 3.5, 3.6+ python (Sourcery refactored) #19

Closed
wants to merge 2 commits into from

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Dec 7, 2022

Pull Request #18 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/rec/safer pull/18/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
Copy link
Author

sourcery-ai bot commented Dec 7, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.93 ⭐ 4.95 ⭐ 0.02 👎
Method Length 52.38 ⭐ 52.32 ⭐ -0.06 👍
Working memory 4.85 ⭐ 4.87 ⭐ 0.02 👎
Quality 77.20% 77.10% -0.10% 👎
Other metrics Before After Change
Lines 1373 1403 30
Changed files Quality Before Quality After Quality Change
safer.py 55.77% 🙂 55.31% 🙂 -0.46% 👎
setup.py 87.94% ⭐ 87.94% ⭐ 0.00%
test/get_help.py 93.32% ⭐ 93.32% ⭐ 0.00%
test/test_doc.py 92.21% ⭐ 92.29% ⭐ 0.08% 👍
test/test_dump.py 89.39% ⭐ 89.39% ⭐ 0.00%
test/test_files.py 88.22% ⭐ 88.20% ⭐ -0.02% 👎
test/test_open.py 82.01% ⭐ 82.01% ⭐ 0.00%
test/test_printer.py 84.18% ⭐ 84.18% ⭐ 0.00%
test/test_writer.py 89.08% ⭐ 89.12% ⭐ 0.04% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
safer.py open 32 😞 329 ⛔ 16.74% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
safer.py writer 28 😞 230 ⛔ 14 😞 26.91% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
safer.py dump 24 😞 183 😞 9 🙂 41.27% 😞 Refactor to reduce nesting. Try splitting into smaller methods
test/test_open.py TestSafer.test_two_errors 5 ⭐ 222 ⛔ 8 🙂 56.18% 🙂 Try splitting into smaller methods
safer.py _FileCloser._make_stream 7 ⭐ 137 😞 8 🙂 61.72% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants