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

Allow pre-commit -o HEAD #199

Merged
merged 3 commits into from
Sep 20, 2021
Merged

Allow pre-commit -o HEAD #199

merged 3 commits into from
Sep 20, 2021

Conversation

akaihola
Copy link
Owner

With this patch, Darker will modify files when called by pre-commit -o HEAD, and emit a warning about this being an experimental feature.

With any other values than HEAD for pre-commit -o, Darker will still refuse to modify files.

Fixes #180. See the issue for detailed discussion.

@akaihola akaihola added the enhancement New feature or request label Sep 19, 2021
@akaihola akaihola added this to the 1.3.1 milestone Sep 19, 2021
@akaihola akaihola requested a review from jabesq September 19, 2021 11:32
@akaihola akaihola self-assigned this Sep 19, 2021
@akaihola akaihola requested review from CorreyL and sherbie September 19, 2021 11:33
@akaihola akaihola force-pushed the allow-pre-commit-to-ref-head branch from 6e9186c to 8cb8fa7 Compare September 19, 2021 11:42
@akaihola akaihola force-pushed the allow-pre-commit-to-ref-head branch 2 times, most recently from 0b95af0 to 919a652 Compare September 20, 2021 19:20
@akaihola akaihola force-pushed the allow-pre-commit-to-ref-head branch from 919a652 to 4bba3cc Compare September 20, 2021 19:24
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 20, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 8.90 🙂 9.01 🙂 0.11 👎
Method Length 105.38 🙂 103.46 🙂 -1.92 👍
Working memory 12.70 😞 12.18 😞 -0.52 👍
Quality 52.57% 🙂 54.22% 🙂 1.65% 👍
Other metrics Before After Change
Lines 886 934 48
Changed files Quality Before Quality After Quality Change
src/darker/main.py 43.40% 😞 42.23% 😞 -1.17% 👎
src/darker/tests/test_main.py 63.27% 🙂 66.30% 🙂 3.03% 👍

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 29 😞 365 ⛔ 15 😞 20.34% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/darker/tests/test_main.py test_main 6 ⭐ 434 ⛔ 24 ⛔ 30.58% 😞 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 ⭐ 241 ⛔ 14 😞 49.14% 😞 Try splitting into smaller methods. Extract out complex expressions
src/darker/main.py format_edited_parts 10 🙂 84 🙂 11 😞 59.66% 🙂 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!

@akaihola akaihola merged commit 13e07e9 into master Sep 20, 2021
@akaihola akaihola deleted the allow-pre-commit-to-ref-head branch September 20, 2021 19:30
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
Development

Successfully merging this pull request may close these issues.

Error with pre-commit: Error when running on git HEAD commit
1 participant