forked from psf/black
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): Support
--config
in pyproject.toml
You can now specify `config` key in pyproject.toml which does the same job as the CLI option `--config`. The path of config should be relative to the CWD it is running from. If the file is not found or is invalid i.e. it is a folder rather a TOML file it would raise `click.exceptions.FileError`, and if the file can't be parsed it would raise `tomli.TOMLDecodeError`. All black config keys in the custom config should be registered under `[black]` and they would overwrite the config specified in pyproject but not the one specified by `--config` flag while running black with the CLI. Closes psf#1826
- Loading branch information
1 parent
3b2a7d1
commit f6e1aad
Showing
7 changed files
with
95 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[tool.black] | ||
config = "tests/bazqux.toml" | ||
verbose = 1 | ||
--check = "no" | ||
diff = "y" | ||
color = true | ||
line-length = 79 | ||
target-version = ["py36", "py37", "py38"] | ||
exclude='\.pyi?$' | ||
include='\.py?$' | ||
|
||
[v1.0.0-syntax] | ||
# This shouldn't break Black. | ||
contributors = [ | ||
"Foo Bar <foo@example.com>", | ||
{ name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[tool.black] | ||
config = "tests/test_black.toml" | ||
verbose = 1 | ||
--check = "no" | ||
diff = "y" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[black] | ||
line-length = 88 |