sourcery
sourcery copied to clipboard
Read configuration from `pyproject.toml`
Issue description or question
PEP 518 introduces the pyproject.toml file and recommends specifying tool configuration data in the [tool] table. Having all configurations in one place makes it easier for developers to inspect and maintain them while keeping the working directory clean.
Many other tools already accept pyproject.toml files as their main configuration file: black, isort and poetry, to name a few. I would love to see Sourcery among them ;)
In this way, the following YAML file:
.sourcery.yaml
ignore: []
refactor:
skip:
- assign-if-exp
- de-morgan
metrics:
quality_threshold: 25.0
clone_detection:
min_lines: 3
min_duplicates: 2
identical_clones_only: false
github:
labels: []
ignore_labels: [sourcery-ignore]
request_review:
origin: owner
forked: author
sourcery_branch: sourcery/{base_branch}
should be equivalent to the following TOML section:
pyproject.toml
[tool.sourcery]
ignore = []
[tool.sourcery.refactor]
skip = ["assign-if-exp", "de-morgan"]
[tool.sourcery.metrics]
quality_threshold = 25.0
[tool.sourcery.clone_detection]
min_lines = 3
min_duplicates = 2
identical_clones_only = false
[tool.sourcery.github]
labels = []
ignore_labels = ["sourcery-ignore"]
sourcery_branch = "sourcery/{base_branch}"
[tool.sourcery.github.request_review]
origin = "owner"
forked = "author"
Sourcery Version
0.9.4
Code editor or IDE name and version
VS Code 1.60.0 (x64)
OS name and version
Ubuntu 20.04.3 LTS
I agree that this would be a great addition to Sourcery.