diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f1ba44..975178d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,3 +3,13 @@ repos: rev: "0.13.0" hooks: - id: pyproject-fmt +# Ruff must be run before Black, so Black can reformat fixes made by Ruff +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.282 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] +- repo: https://github.com/psf/black + rev: "23.7.0" + hooks: + - id: black diff --git a/README.md b/README.md index f0003d9..d9e23a3 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,11 @@ global open source software community, in addition to Python itself. I've listed many of them below, but if I've overlooked any please do not be offended :-) -* [Black](https://github.com/psf/black) -* [Hatch-Fancy-PyPI-Readme](https://github.com/hynek/hatch-fancy-pypi-readme) -* [Hatch](https://github.com/pypa/hatch) -* [Mypy](https://github.com/python/mypy) -* [Pytest](https://github.com/pytest-dev/pytest) -* [Ruff](https://github.com/astral-sh/ruff) -* [Towncrier](https://github.com/twisted/towncrier) +* [Black](https://pypi.org/project/black) +* [Hatch-Fancy-PyPI-Readme](https://pypi.org/project/hatch-fancy-pypi-readme) +* [Hatch](https://pypi.org/project/hatch) +* [Mypy](https://pypi.org/project/mypy) +* [pyproject-fmt](https://pypi.org/project/pyproject-fmt) +* [Pytest](https://pypi.org/project/pytest) +* [Ruff](https://pypi.org/project/ruff) +* [Towncrier](https://pypi.org/project/towncrier) diff --git a/pyproject.toml b/pyproject.toml index 981079b..5515a3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,28 +86,29 @@ dependencies = [ "black", "ruff", "mypy", - "pytest", # needed for type-checking tests + "pyproject-fmt", ] [tool.hatch.envs.lint.scripts] lint = [ - "black --preview src tests", - "ruff check --fix -- src tests", + "ruff check --fix --show-fixes .", + "black --preview .", "mypy --package jinjanator_plugin_ansible", "mypy tests", "shellcheck workflow-support/*.sh", + "pyproject-fmt pyproject.toml", ] lint-action = [ - "black --check --diff --preview src tests", - "ruff check --format=github -- src tests", + "ruff check --format=github .", + "black --check --diff --preview .", "mypy --package jinjanator_plugin_ansible", "mypy tests", "shellcheck workflow-support/*.sh", + "pyproject-fmt --check pyproject.toml", ] [tool.hatch.envs.ci] dependencies = [ - "attrs", "coverage[toml]", "pytest", "pytest-cov", @@ -172,6 +173,7 @@ replacement = "[#\\1](https://github.com/kpfleming/jinjanator-plugin-ansible/iss [tool.black] line-length = 90 +target-version = ["py39"] [tool.ruff] src = ["src", "tests"]