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

Configuration file(s) #49

Closed
1 task
akaihola opened this issue Aug 8, 2020 · 1 comment · Fixed by #58
Closed
1 task

Configuration file(s) #49

akaihola opened this issue Aug 8, 2020 · 1 comment · Fixed by #58
Labels
enhancement New feature or request
Milestone

Comments

@akaihola
Copy link
Owner

akaihola commented Aug 8, 2020

Like with Black, it would be convenient to be able to set Darker's options not only on the command line but also in per-repository configuration files.

I was also thinking in a config file (pyproject.toml at the root of the repo?) having the ability to >give a revision to be used by default. But +1.
Originally posted by @Carreau in #43 (comment)

@akaihola
Copy link
Owner Author

akaihola commented Aug 16, 2020

We'll need to settle for (1) the location(s) of Darker configuration, and (2) the format of it.

My number one proposal would be pyproject.toml and a [tool.darker] section in it. This is what both Black and isort already support, and seems to be becoming the standard.

Mapping command line options to directly to pyproject.toml would suggest a format like this (with default values shown here):

[tool.darker]
src = []
revision = "HEAD"
diff = false
check = false
isort = false
lint = []
log_level = "WARNING"

So if I'd like to make these options default:

darker -vv -r master --check --diff --isort -L flake8 -L mypy -L pylint -L cov_to_lint.py src  

I would put this in pyproject.toml:

[tool.darker]
src = [
    "src",
]
revision = "master"
diff = true
check = true
isort = true
lint = [
    "flake8",
    "mypy",
    "pylint",
    "cov_to_lint.py",
]
log_level = "DEBUG"

akaihola added a commit that referenced this issue Aug 16, 2020
Also dumps configuration on terminal if debug level logging is enabled
with the `-vv` or `--verbose --verbose` command line option.
@akaihola akaihola linked a pull request Aug 16, 2020 that will close this issue
akaihola added a commit that referenced this issue Aug 19, 2020
Also dumps configuration on terminal if debug level logging is enabled
with the `-vv` or `--verbose --verbose` command line option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant