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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to require a specific version to be running #2300
Conversation
if code is None: | ||
click.secho(str(report), err=True) | ||
click.echo(str(report), err=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit unrelated but noticed that styling isn't used here, so I changed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of wording comments.
Also, what about --release
for the version name? After all, it only works with released versions.
Now going to check if other tools (Prettier, gofmt?) also have options like this that we could steal the name of.
Rustfmt uses Prettier, gofmt, and clang-format don't appear to have a similar option. |
That or "release", both sound good to me! I think I'll go with "required version" in the absense of other comments, because it's more explicit. Thanks a lot for the wording improvements! |
@@ -368,6 +377,17 @@ def main( | |||
config: Optional[str], | |||
) -> None: | |||
"""The uncompromising code formatter.""" | |||
if config and verbose: | |||
out(f"Using configuration from {config}.", bold=False, fg="blue") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the previous printing of config file location on fail, I think it's better to leave it to --verbose.
There ya go, keep the comments coming if something else is off! Uh, I'm not entirely sure why the test is failing. Before going off the deep end: are those random test failures I've read about still a thing? |
Sounds good! The test failure indeed looks random. It occurred to me that this option name could be confused with |
Thank you so much! |
Closes #1246: This PR adds a new option (and automatically a toml entry, hooray for existing configuration management 馃帀) to require a specific version of Black to be running.
For example:
black --required-version 20.8b -c "format = 'this'"
Execution fails straight away if it doesn't match
__version__
. Some points of contention:revision was suggested in the issue, I agree that it's the most appropriate, but it isn't perfect. Other possibilities:runtime-version
,black-version
..?required-version
was chosenparticularly printing the configuration location