-
Notifications
You must be signed in to change notification settings - Fork 56
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
Fix AST verification and historical comparisons #138
Conversation
@samoylovfp, I assigned this to you since we collaborated also on #94 and you may remember the change I made there. The description isn't actually accurate currently, I'm trying to rethink this through to figure out what's happening exactly. Edit: Can't figure it out now, just made the description a bit more general. Note that I found another bug which is related to the same code paths, and included the fix for that one in this PR as well. |
5e245b2
to
5c4a9db
Compare
5c4a9db
to
c4ca2af
Compare
@ivanov and/or @samoylovfp, do you think you'll be able to review this? One option I'd like to try at some point in this project is to have a pair/group video call session where a pull request author walks through their proposed changes. Maybe this PR is a candidate for such? |
If a file is already correctly formatted, the AST verification should of course pass. Fixes #137.
c4ca2af
to
975e3ee
Compare
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.95%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe 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. |
I re-reviewed this myself. Merging now since other contributors are busy. |
This pull request fixes three bugs:
AST verification no longer erroneously fails when using
--isort
.This bug was introduced in #94 and is present in version 1.2.3.
Historical comparisons, e.g. comparing two past commits like
darker --diff v1.0..v1.1
would still compare against the file on disk in the working tree, not the second commit. This has been fixed.Darker would write historical reformats on disk, overwriting a newer version in the working tree. Now an exception is raised instead if a historical comparison like
darker --revision=commit1..commit2
is used without--diff
or--check
.