Closed AngellusMortis closed 5 years ago
I'm curious, could you point me at a couple of projects using black
with the --config
option?
How would you see this working from flake8
? A flake8-black
plugin specific configuration setting within the flake8
configuration file being used?
Also note that currently flake8-black
does not respect everything in the black pyproject.toml
settings (e.g. includes and excludes are not currently respected, as stated in the README).
Proposal from discussion on #10 with @098799:
Add an optional flake8 setting for the plugin (i.e. in file .flake8
, setup.cfg
, or tox.ini
- whatever the user has picked), giving the filename of a black configuration file to use.
e.g. Something like this (not sure about the best key name to use here, suggestions?):
[flake8]
flake8-black-config = /mnt/shared/config/black.toml
This would be like using black --config /mnt/shared/config/black.toml ...
at the command line?
In discussion on #11, I think rather than flake8-black-config
we could just use black-config
as the setting name, equivalently:
$ flake8 --black-config /mnt/shared/config/black.toml ...
Closed by #11, this will be in release v0.1.1
Is it useful to be able to explicit say run flake8-black
with NO black configuration TOML file at all?
e.g. flake8 --black-config '' ...
(that's two single quotes - bash would take two double quotes as well), meaning an empty string? Sadly there doesn't seem to be a good way to do this in a flake8 config file, the following and variations like seems to act the same as leaving out the setting:
[flake8]
black-config=''
Instead, I am considering e.g. flake8 --black-config - ...
(that's a minus sign), or in a flake8 config file, something like the following:
[flake8]
black-config='-' # Explicitly do not use any black TOML file
What's your use case for that? I assume that this would be ran only in projects with pyproject.toml
specified, but then why would one want to check against standard black
?
On a large project you might aspire to follow default black, but have to work towards this gradually.
It occurs to me another way someone might expect to do this would be to piggy-back on the flake8 --isolated ...
option, but that seems a bit too magic to me?
TBH sounds like just about right amount of magic to me :) (as long as it's properly documented) We should be able to smuggle that in from parse_options
, right?
We should be able to, much like how earlier iterations of this plugin accessed the max-line-length setting.
It would be great to be able to specify the location of the
pyproject.toml
file for more advanced setups.black
currently allows setting the location of thepyproject.toml
file with the--config
option.