-
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
darker can bisect context lines without a reason #204
Comments
Thanks @rogalski! I created mixed.py (had to rename to If I run Black on it, I get this: $ black --diff mixed.py
error: cannot format mixed.py:
INTERNAL ERROR:
Black produced code that is not equivalent to the source on pass 1.
Please report a bug on https://github.com/psf/black/issues.
This diff might be helpful: /tmp/blk_e5me14ox.log
Oh no! 💥 💔 💥
1 file would fail to reformat. Here's blk_e5me14ox.log from Black. So I presume this is what happens when Darker processes this file as well. The call to I've seen AST verification failures happen on real-life files which don't contain mixed tabs and spaces, and the chunk expansion algorithm is a valid work-around for those situations. Could we short-circuit that mechanism here? How do we detect that it's no use even trying to find a minimal set of extra reformattings? |
My intuitive argumentation was following:
This of course is design decision more than actual bug, yet it vastly simplifies implementation and corner case handling while keeping things relatively straightforward for customer. |
Darker directly calls What we could add is an extra step: I drafted a diagram showing the added new behavior: |
Sounds good to me 👍 |
Moving this to milestone 1.5.0, there are a plenty of bugfixes and documentation improvements coming up for a 1.4.2 bugfix release already. |
@rogalski & @overratedpro, is there any chance you could review if I start to implement this for release 1.5.0? |
This bug is based on my experiments with
darker
on closed-source repo.I am not at liberty to disclose any code. We'll have to work on recreating failure criteria on our own.
Steps to reproduce
If initial reformat do not produce equivalent AST, all of bisection steps will fail anyway.
The text was updated successfully, but these errors were encountered: