From 63e4654f0be643ca0f1676227db24bb7f88dee29 Mon Sep 17 00:00:00 2001 From: Steffen Scheib <37306894+sscheib@users.noreply.github.com> Date: Wed, 20 Mar 2024 23:54:03 +0100 Subject: [PATCH] Adding configuration for pre-commit (#190) * Adding configuration for pre-commit * Adding a note about usage as pre-commit hook * Correcting PySpelling and putting pre-commit into an inline codeblock * Correcting pass_filenames * Correcting a small typo * Fixing one more typo * Fixing markdown section --- .pre-commit-hooks.yaml | 10 ++++++++++ docs/src/markdown/index.md | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..3cd2487 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,10 @@ +--- +- id: 'pyspelling' + name: 'pyspelling' + description: 'This hook runs pyspelling' + language: 'python' + entry: 'pyspelling' + pass_filenames: false + additional_dependencies: + - 'pymdown-extensions' +... diff --git a/docs/src/markdown/index.md b/docs/src/markdown/index.md index 4dbc17c..10bc98f 100644 --- a/docs/src/markdown/index.md +++ b/docs/src/markdown/index.md @@ -309,3 +309,23 @@ jobs: In *this* project, we actually use `tox` to make running our tests locally and in CI easier. If you would like to use `tox` as well, you can check out how this project does it by taking a look at the source. + +## Usage as `pre-commit` Hook + +PySpelling can be used as a [`pre-commit`](https://pre-commit.com/) hook. To use it as a `pre-commit` hook, please have a +look at the following example `.pre-commit-config.yaml`: + +```yaml +--- +repos: + - repo: 'https://github.com/facelessuser/pyspelling.git' + rev: 'v2.11' + hooks: + - id: 'pyspelling' + verbose: true + pass_filenames: false +... +``` + +Please note that version tags should be preferred over using the `master` branch as revision (`rev`) attribute, as the +`master` branch is considered unstable.