Closed 098799 closed 5 years ago
What is the motivation? Is the current behaviour not following what black
does:
https://black.readthedocs.io/en/stable/pyproject_toml.html#where-black-looks-for-the-file
See also discussion on #9.
Current configuration is mirroring what black does. The problem is black doesn't allow for global config the way e.g. flake8 or isort do.
Our needs require a unified configuration across several projects. We prefer to configure once in the Dockerfile base instead of including configuration in all repos.
Regarding the discussion, I was on the fence between using .config/flake8
and copying the same approach from pyproject.toml
but decided the second is less complex and doesn't require new definitions which wouldn't be used anywhere outside this particular use case.
Adding yet another tool specific configuration file $HOME/.config/flake8-black/pyproject.toml
seems to just make things more confusing.
How about instead adding a .flake8
setting for this plugin, pointing at the black configuration file to use?
This would be like using black --config /mnt/shared/config/black.toml ...
at the command line?
As noted on #9, I am keen to see some real world examples using custom black configuration files.
As an aside, is there an open issue on black to support a global configuration file? I had a little search but couldn't find one.
This would be like using
black --config /mnt/shared/config/black.toml ...
at the command line?
Probably a better solution, yes.
As noted on #9, I am keen to see some real world examples using custom black configuration files.
No idea, we don't use it yet, but probably will end up disabling string normalization and setting the line length to 120 to minimize the diff in the transition.
As an aside, is there an open issue on black to support a global configuration file? I had a little search but couldn't find one.
Probably https://github.com/psf/black/issues/810 comes the closest. But taking into account the rate of black
development since last september, I wouldn't count on that...
OK, so shall I close this pull request in favour of the that configuration approach?
If you have it ready, that would be great. If not, I'll probably try to hack it together in the nearest future.
I have no code written for this, and to be honest I am unlikely to work on this myself - at least not any time soon. If you want to work on it, great 👍
If no
pyproject.toml
file is found, flake8-black will fallback on the global configuration forblack
found in$HOME/.config/flake8-black/pyproject.toml
. Syntax stays the same.