rec / safer

๐Ÿงท A safer writer ๐Ÿงท
https://rec.github.io/safer/
MIT License
174 stars 10 forks source link

tidy for 3.5, 3.6+ python #18

Closed marksmayo closed 9 months ago

marksmayo commented 1 year ago

and clean up of imports

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.93 โญ 4.93 โญ 0.00
Method Length 52.38 โญ 52.42 โญ 0.04 ๐Ÿ‘Ž
Working memory 4.85 โญ 4.85 โญ 0.00
Quality 77.20% โญ 77.19% โญ -0.01% ๐Ÿ‘Ž
Other metrics Before After Change
Lines 1373 1405 32
Changed files Quality Before Quality After Quality Change
safer.py 55.77% ๐Ÿ™‚ 55.73% ๐Ÿ™‚ -0.04% ๐Ÿ‘Ž
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.21% โญ 0.00%
test/test_dump.py 89.39% โญ 89.39% โญ 0.00%
test/test_files.py 88.22% โญ 88.22% โญ 0.00%
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.08% โญ 0.00%

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 ๐Ÿ˜ž 231 โ›” 14 ๐Ÿ˜ž 26.85% ๐Ÿ˜ž 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:

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!

rec commented 1 year ago

I would want to merge this, except it takes my sorted imports and unsorts them!