Consider we have a user's "global" black configuration in ~/repositories/black.toml and multiple projects under this folder, where ~/repositories/project/.flake8 contains:
[flake8]
black_config=../black.toml
Then, you might run:
cd ~/repositories/project/
flake8 tests/
cd tests/
flake8 .
Both the above should find the ~/repositories/project/.flake8 file, which will load ../black.toml as the location of the black configuration file, which should be converted relative to ~/repositories/project/.flake8 giving ~/repositories/black.toml.
However, now suppose the users does the following, where the command line setting will override any values set via the flake8 configuration files (see https://gitlab.com/pycqa/flake8/issues/560 for clarifying this):
cd ~/repositories/project/
flake8 --black-config ../black.toml tests/
cd tests/
flake8 --black-config ../../black.toml .
Here the relative paths ../black.toml and ../../black.toml should both be interpreted relative to the current directory, and both give ~/repositories/black.toml.
However, if the plugin just gets a string ../black.toml or ../../black.toml, how is it to infer the starting path (a config file location or the present directory)? i.e. How was the setting given (which config file, or was it the command line)?
Cross reference https://gitlab.com/pycqa/flake8/issues/561
If we can't tell, we could be pragmatic and just try both, and maybe give an error if both interpretations exist but are different paths?
Consider we have a user's "global" black configuration in
~/repositories/black.tomland multiple projects under this folder, where~/repositories/project/.flake8contains:Then, you might run:
Both the above should find the
~/repositories/project/.flake8file, which will load../black.tomlas the location of the black configuration file, which should be converted relative to~/repositories/project/.flake8giving~/repositories/black.toml.However, now suppose the users does the following, where the command line setting will override any values set via the flake8 configuration files (see https://gitlab.com/pycqa/flake8/issues/560 for clarifying this):
Here the relative paths
../black.tomland../../black.tomlshould both be interpreted relative to the current directory, and both give~/repositories/black.toml.However, if the plugin just gets a string
../black.tomlor../../black.toml, how is it to infer the starting path (a config file location or the present directory)? i.e. How was the setting given (which config file, or was it the command line)?Cross reference https://gitlab.com/pycqa/flake8/issues/561
If we can't tell, we could be pragmatic and just try both, and maybe give an error if both interpretations exist but are different paths?