Skip to content

Commit 4ede2d2

Browse files
committed
clean up pre-commit
1 parent 3130a2e commit 4ede2d2

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,26 @@ jobs:
7777
run: |
7878
codecov
7979
80+
pre-commit:
81+
name: pre-commit
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v2
85+
- uses: actions/setup-python@v2
86+
- uses: pre-commit/[email protected]
87+
with:
88+
extra_args: --all-files --hook-stage=manual
89+
- name: Help message if pre-commit fail
90+
if: ${{ failure() }}
91+
run: |
92+
echo "You can install pre-commit hooks to automatically run formatting"
93+
echo "on each commit with:"
94+
echo " pre-commit install"
95+
echo "or you can run by hand on staged files with"
96+
echo " pre-commit run"
97+
echo "or after-the-fact on already committed files with"
98+
echo " pre-commit run --all-files --hook-stage=manual"
99+
80100
test_docs:
81101
runs-on: ${{ matrix.os }}
82102
strategy:

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ repos:
3434
hooks:
3535
- id: prettier
3636

37+
- repo: https://github.com/PyCQA/doc8
38+
rev: 0.11.1
39+
hooks:
40+
- id: doc8
41+
args: [--max-line-length=200]
42+
stages: [manual]
43+
3744
- repo: https://github.com/pycqa/flake8
3845
rev: 4.0.1
3946
hooks:
@@ -44,8 +51,20 @@ repos:
4451
"flake8-logging-format==0.6.0",
4552
"flake8-implicit-str-concat==0.2.0",
4653
]
54+
stages: [manual]
4755

4856
- repo: https://github.com/pre-commit/mirrors-eslint
4957
rev: v8.12.0
5058
hooks:
5159
- id: eslint
60+
stages: [manual]
61+
62+
- repo: https://github.com/sirosen/check-jsonschema
63+
rev: 0.14.2
64+
hooks:
65+
- id: check-jsonschema
66+
name: "Check GitHub Workflows"
67+
files: ^\.github/workflows/
68+
types: [yaml]
69+
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
70+
stages: [manual]

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ hook with `pre-commit install`, you can fix everything up using
4242
`pre-commit run --all-files`. You need to make the fixing commit
4343
yourself after that.
4444

45+
Some of the hooks only run on CI by default, but you can invoke them by
46+
running with the `--hook-stage manual` argument.
47+
4548
## Releasing ipykernel
4649

4750
Releasing ipykernel is _almost_ standard for a Python package:

0 commit comments

Comments
 (0)