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

Respect black exclude #171

Merged
merged 6 commits into from
Aug 1, 2021
Merged

Respect black exclude #171

merged 6 commits into from
Aug 1, 2021

Conversation

akaihola
Copy link
Owner

Skip Black reformatting for files matching the exclude, extend-exclude or force-exclude Black configuration options. Fixes #146.

@akaihola akaihola self-assigned this Jul 30, 2021
@akaihola akaihola added the enhancement New feature or request label Jul 30, 2021
@akaihola akaihola added this to the 1.3.0 milestone Jul 30, 2021
akaihola added 6 commits July 30, 2021 23:44
Separate reformatting a single file into its own function. This is in
preparation for supporting Black excludes. Also will make Sourcery
happier.
This used to be done for each file separately and cached.
@akaihola akaihola force-pushed the respect-black-exclude branch from f1af83c to b097141 Compare July 31, 2021 19:39
@sourcery-ai
Copy link

sourcery-ai bot commented Jul 31, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 2.68%.

Quality metrics Before After Change
Complexity 8.24 ⭐ 6.64 ⭐ -1.60 👍
Method Length 98.14 🙂 100.81 🙂 2.67 👎
Working memory 11.03 😞 10.64 😞 -0.39 👍
Quality 56.67% 🙂 59.35% 🙂 2.68% 👍
Other metrics Before After Change
Lines 910 1168 258
Changed files Quality Before Quality After Quality Change
src/darker/main.py 36.17% 😞 43.29% 😞 7.12% 👍
src/darker/black_diff.py 78.22% ⭐ 75.56% ⭐ -2.66% 👎
src/darker/tests/test_black_diff.py 76.84% ⭐ 73.37% 🙂 -3.47% 👎
src/darker/tests/test_main.py 67.34% 🙂 65.95% 🙂 -1.39% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
src/darker/main.py main 23 😞 311 ⛔ 14 😞 26.32% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/darker/tests/test_main.py test_main 4 ⭐ 402 ⛔ 20 ⛔ 34.77% 😞 Try splitting into smaller methods. Extract out complex expressions
src/darker/main.py _reformat_single_file 10 🙂 199 😞 18 ⛔ 37.92% 😞 Try splitting into smaller methods. Extract out complex expressions
src/darker/tests/test_main.py test_format_edited_parts 0 ⭐ 244 ⛔ 14 😞 48.98% 😞 Try splitting into smaller methods. Extract out complex expressions
src/darker/tests/test_black_diff.py test_apply_black_excludes 4 ⭐ 185 😞 11 😞 53.73% 🙂 Try splitting into smaller methods. Extract out complex expressions

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!

@roniemartinez
Copy link
Collaborator

Looks good. 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
2 participants