Skip to content

Commit 8a792d9

Browse files
committed
clean up pre-commit
1 parent 77be2f5 commit 8a792d9

File tree

4 files changed

+27
-31
lines changed

4 files changed

+27
-31
lines changed

.github/workflows/python-tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ jobs:
4343
run: |
4444
codecov
4545
46+
pre-commit:
47+
name: pre-commit
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v2
51+
- uses: actions/setup-python@v2
52+
- uses: pre-commit/[email protected]
53+
with:
54+
extra_args: --all-files --hook-stage=manual
55+
- name: Help message if pre-commit fail
56+
if: ${{ failure() }}
57+
run: |
58+
echo "You can install pre-commit hooks to automatically run formatting"
59+
echo "on each commit with:"
60+
echo " pre-commit install"
61+
echo "or you can run by hand on staged files with"
62+
echo " pre-commit run"
63+
echo "or after-the-fact on already committed files with"
64+
echo " pre-commit run --all-files --hook-stage=manual"
65+
4666
test_docs_and_examples:
4767
name: Test Docs and Examples
4868
timeout-minutes: 10

.github/workflows/trigger_precommit.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
ci:
2-
skip: [check-jsonschema]
3-
41
repos:
52
- repo: https://github.com/pre-commit/pre-commit-hooks
63
rev: v4.1.0
@@ -47,6 +44,7 @@ repos:
4744
hooks:
4845
- id: doc8
4946
args: [--max-line-length=200]
47+
stages: [manual]
5048

5149
- repo: https://github.com/pycqa/flake8
5250
rev: 4.0.1
@@ -58,6 +56,7 @@ repos:
5856
"flake8-logging-format==0.6.0",
5957
"flake8-implicit-str-concat==0.2.0",
6058
]
59+
stages: [manual]
6160

6261
- repo: https://github.com/pre-commit/mirrors-eslint
6362
rev: v8.12.0
@@ -72,3 +71,4 @@ repos:
7271
files: ^\.github/workflows/
7372
types: [yaml]
7473
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
74+
stages: [manual]

CONTRIBUTING.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,17 @@ You can invoke the pre-commit hook by hand at any time with::
5959

6060
which should run any autoformatting on your code
6161
and tell you about any errors it couldn't fix automatically.
62-
You may also install [black integration](https://github.com/psf/black#editor-integration)
62+
You may also install `black integration <https://github.com/psf/black#editor-integration>`_
6363
into your text editor to format code automatically.
6464

6565
If you have already committed files before setting up the pre-commit
6666
hook with ``pre-commit install``, you can fix everything up using
6767
``pre-commit run --all-files``. You need to make the fixing commit
6868
yourself after that.
6969

70+
Some of the hooks only run on CI by default, but you can invoke them by
71+
running with the ``--hook-stage manual`` argument.
72+
7073
Troubleshooting the Installation
7174
--------------------------------
7275

0 commit comments

Comments
 (0)