Add support for setting configuration with pyproject.toml
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
Many other linter or formatter tools like `pylint`, `black`, or `isort` support configuration via the `pyproject.toml` file.
I think it would be very clean to include running `libcst` codemods as pre-commit hooks or similar in repos if one was not required to create a `.libcst.codemod.yaml` file and instead could add the necessary configuration to an existing `pyproject.toml` file.
It might look something like this:
```toml
[tool.libcst.codemod]
# String that LibCST should look for in code which indicates that the
# module is generated code.
generated_code_marker = "@generated"
# Command line and arguments for invoking a code formatter. Anything
# specified here must be capable of taking code via stdin and returning
# formatted code via stdout.
formatter = ["black", "-"]
# List of regex patterns which LibCST will evaluate against filenames to
# determine if the module should be touched.
blacklist_patterns = []
# List of modules that contain codemods inside of them.
modules = ["libcst.codemod.commands"]
# Absolute or relative path of the repository root, used for providing
# full-repo metadata. Relative paths should be specified with this file
# location as the base.
repo_root = "."
```
Contributor guide
Assessment
This issue has not been assessed yet.