Skip to content

Commit 0d8653f

Browse files
Make the pre-commit hook always run on the same set of files (HunterMcGushion#84)
* Make the pre-commit hook always run on the same set of files * Alert proposed by @killthekitten Co-authored-by: Michael Weiss <code@mweiss.ch>
1 parent a5b5bbb commit 0d8653f

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

.pre-commit-hooks.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
types_or: [cython, pyi, python]
88
minimum_pre_commit_version: "2.9.0"
99
always_run: true
10+
pass_filenames: false

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,18 @@ class FooBarChild(FooBar):
172172

173173
#### Pre-commit hook
174174

175-
You can use `docstr-coverage` as a pre-commit hook by adding the following to your `.pre-commit-config.yaml` file:
176-
177-
To pass arguments to `docstr-coverage`, add a `.docstr.yaml` config (which is automatically picked up).
175+
You can use `docstr-coverage` as a pre-commit hook by adding the following to your `.pre-commit-config.yaml` file
176+
and configuring the `paths` section of the [`.docstr.yaml` config](#config-file).
178177
This is preferrable over [pre-commit args](https://pre-commit.com/#config-args),
179-
as it facilitates the use of the same config in ci / pre-commit and manual runs.
178+
as it facilitates the use of the same config in CI, pre-commit and manual runs.
180179

181180
```yaml
182-
- repo: https://github.com/HunterMcGushion/docstr_coverage
183-
rev: <most recent docstr-coverage release or commit sha>
184-
hooks:
185-
- id: docstr-coverage
181+
repos:
182+
- repo: https://github.com/HunterMcGushion/docstr_coverage
183+
rev: v2.1.0 # most recent docstr-coverage release or commit sha
184+
hooks:
185+
- id: docstr-coverage
186+
args: ["--verbose", "2"] # override the .docstr.yaml to see less output
186187
```
187188
188189
#### Package in Your Project

docstr_coverage/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ def execute(paths, **kwargs):
290290
sys.exit(0)
291291
else:
292292
sys.exit(
293-
"No Python files found "
294-
"(use `--accept-empty` to exit with code 0 if you expect this case)"
293+
"No Python files found. "
294+
"Use `--accept-empty` to exit with code 0 if you expect this case, "
295+
"or specify the paths you'd like to check "
296+
"via command line arguments or the config file."
295297
)
296298

297299
# Parse ignore names file

0 commit comments

Comments
 (0)