diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 00000000..8d2df77e --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,9 @@ +- id: vulture + name: vulture + language: python + entry: vulture + description: Find unused Python code. + types: [python] + pass_filenames: false + require_serial: true + diff --git a/CHANGELOG.md b/CHANGELOG.md index 91d43970..4bf48455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# unreleased + +* Add [pre-commit](https://pre-commit.com) hook (Clément Robert #244). + # 2.2 (2021-01-15) * Only parse format strings when being used with `locals()` (jingw, #225). diff --git a/README.md b/README.md index 8642aed3..50fa9831 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,23 @@ tool for higher code quality. $ pip install vulture +### Version control integration + +After installing [pre-commit](https://pre-commit.com/#install), add the +following to the `.pre-commit-config.yaml` file in your repository: + +```yaml +repos: + - repo: https://github.com/jendrikseipp/vulture + rev: 2.3 + hooks: + - id: vulture +``` + +Then run `pre-commit install`. In order to run Vulture before each commit, you will also +need to specify all files that should be checked in the `pyproject.toml` file under the +`paths` key. + ## Usage $ vulture myscript.py # or