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

CLI flag to disable looking for a configuration file #2537

Closed
felix-hilden opened this issue Oct 14, 2021 · 7 comments
Closed

CLI flag to disable looking for a configuration file #2537

felix-hilden opened this issue Oct 14, 2021 · 7 comments
Labels
C: configuration CLI and configuration T: enhancement New feature or request

Comments

@felix-hilden
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Given that Black always looks for a configuration file, up to the file system root (!), it could be convenient to be able to explicitly not look for any configuration files. This would be advantageous when debugging different options.

Describe the solution you'd like

$ black --config -
$ black --no-config

Or maybe I've just missed it, didn't look at the code yet. In which case it should be documented in the CLI help.

@felix-hilden felix-hilden added T: enhancement New feature or request C: configuration CLI and configuration labels Oct 14, 2021
@ichard26
Copy link
Collaborator

I'm in favour of this flag although I'm not sure if --no-config is the best name for it, perhaps --isolated although that could imply ignoring .gitignore files which this feature request doesn't cover ...

@felix-hilden
Copy link
Collaborator Author

--isolated would be fine by me if we truly isolate the run like you described. I thought --no-config would be recognisable as a reference to flag options, for which Click provides a --no-... variant as well. So would you prefer to use some sentinel value like a single dash?

@ichard26
Copy link
Collaborator

--no-config is probably best then. I'm not a big fan of the positive case being an option and the negated form being a flag, but that seems minor.

@ichard26 ichard26 added S: accepted The changes in this design / enhancement issue have been accepted and can be implemented and removed S: accepted The changes in this design / enhancement issue have been accepted and can be implemented labels Dec 27, 2021
@felix-hilden
Copy link
Collaborator Author

I bet if we made it --config -, someone would present a case where they've named their configuration file exactly that 😄

@JelleZijlstra
Copy link
Collaborator

Do other tools (flake8, mypy, prettier, gofmt...) have an option for this? If so, how does it work?

@felix-hilden
Copy link
Collaborator Author

Mypy has --config-file=. I'm not sure if gofmt has any configuration files 😄

@hauntsaninja
Copy link
Collaborator

Closing, since I don't think there's a lot of appetite for this feature. Note black --config /dev/null works perfectly well for me on Unix systems.

@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: configuration CLI and configuration T: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants