rbanffy / pip-chill

A more relaxed `pip freeze`
Other
555 stars 25 forks source link

Adding omit-self #31

Closed studioj closed 3 years ago

studioj commented 3 years ago

Hi, I learned about your package on the python bytes podcast => https://pythonbytes.fm/episodes/show/208/dependencies-out-of-control-just-pip-chill.

They explained the use of the package but made a remark that it would be handy to not have "pip-chill" printed in the output but stated a workaround with grep for Linux or Mac users.

I, on the other hand, am a Windows user and don't have the convenient grep tool laying around.

I also have reworked your tests so they are more "cross-platformy" and now can be run on the windows platform too (I didn't run on Linux, but would guess it should work => the CI system will tell) (*edit: SUCCESS)

If I need to adjust something in the PR let me know, eager to help out. I noticed a few flake8 errors regarding line length in master itself dunno if I should bother too much?

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.47 ⭐ 3.95 ⭐ -0.52 👍
Method Length 31.53 ⭐ 37.73 ⭐ 6.20 👎
Working memory 6.48 🙂 7.19 🙂 0.71 👎
Quality 80.26% 78.18% -2.08% 👎
Other metrics Before After Change
Lines 256 321 65
Changed files Quality Before Quality After Quality Change
pip_chill/cli.py 67.06% 🙂 65.05% 🙂 -2.01% 👎
pip_chill/pip_chill.py 70.30% 🙂 69.67% 🙂 -0.63% 👎
tests/test_pip_chill.py 87.43% ⭐ 83.08% ⭐ -4.35% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
pip_chill/pip_chill.py chill 22 😞 138 😞 8 🙂 49.23% 😞 Refactor to reduce nesting. Try splitting into smaller methods
tests/test_pip_chill.py TestPip_chill.test_pip_ommitted.test_all.test_hashes.test_command_line_interface_omits_ignored 1 ⭐ 61 ⭐ 10 😞 73.75% 🙂 Extract out complex expressions
tests/test_pip_chill.py TestPip_chill.test_pip_ommitted.test_all.test_hashes.test_command_line_interface_omits_ignored.test_command_line_interface_all.test_command_line_interface_short_all.test_command_line_interface_long_all.test_command_line_interface_omit_self_on_request 0 ⭐ 55 ⭐ 10 😞 75.69% ⭐ Extract out complex expressions
tests/test_pip_chill.py TestPip_chill.test_pip_ommitted.test_all.test_hashes.test_command_line_interface_omits_ignored.test_command_line_interface_all.test_command_line_interface_short_all.test_command_line_interface_long_all.test_command_line_interface_short_omit_self_on_request 0 ⭐ 55 ⭐ 10 😞 75.69% ⭐ Extract out complex expressions
tests/test_pip_chill.py TestPip_chill.test_pip_ommitted.test_all.test_hashes.test_command_line_interface_omits_ignored.test_command_line_interface_all.test_command_line_interface_short_all.test_command_line_interface_long_all.test_command_line_interface_doesnt_omit_self_by_default 0 ⭐ 55 ⭐ 10 😞 75.69% ⭐ 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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

studioj commented 3 years ago

I had to lock bandit to an earlier version since they dropped support for py2

studioj commented 3 years ago

should i open this PR to the develop branch?

rbanffy commented 3 years ago

I ended up implementing a --no-chill cli option for removing pip-chill from the listing (wrote it after listening to the podcast, but pushed it today). Your other changes are, however, nice. Would you mind redoing this PR's other enhancements against the latest develop branch?