summaryrefslogtreecommitdiff
path: root/.pre-commit-config.yaml
diff options
context:
space:
mode:
authorIwan Aucamp <aucampia@gmail.com>2022-01-30 15:41:35 +0100
committerIwan Aucamp <aucampia@gmail.com>2022-01-30 15:51:57 +0100
commit3700b6c3a00ec7c543a9baf3ba3b8b26c4d81383 (patch)
tree38242a3c972d5fdef6ca9a0bd856fa9989732705 /.pre-commit-config.yaml
parentbe4c81f1c5d7007fbe057ba4f2497a335aa3ea3d (diff)
downloadrdflib-3700b6c3a00ec7c543a9baf3ba3b8b26c4d81383.tar.gz
Change to a local hook for black
This is to work around this issue: https://github.com/psf/black/issues/2493 Without doing this the pre-commit hook for black fails as it thinks it got the wrong version.
Diffstat (limited to '.pre-commit-config.yaml')
-rw-r--r--.pre-commit-config.yaml21
1 files changed, 17 insertions, 4 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0612c1d4..d61ae937 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -5,8 +5,21 @@ ci:
autofix_prs: false
repos:
- - repo: https://github.com/psf/black
- # WARNING: rev should be the same as in `pyproject.toml`.
- rev: 21.9b0
+ - repo: local
hooks:
- - id: black
+ # using a local hook for black because of an issue that arises when using
+ # pre-commit and setuptools-scm that results in version info being lost.
+ # For more info see https://github.com/psf/black/issues/2493
+ # Based on https://github.com/psf/black/blob/main/.pre-commit-hooks.yaml
+ - id: black
+ name: black
+ description: "Black: The uncompromising Python code formatter"
+ entry: black
+ language: python
+ # WARNING: version should be the same as in `pyproject.toml`.
+ additional_dependencies: [black==21.9b0]
+ # This is here to defer file selection to black which will do it based on
+ # black config.
+ pass_filenames: false
+ require_serial: true
+ args: ["."]