Skip to content

Commit

Permalink
clean up pre-commit (#1757)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Apr 9, 2022
1 parent 36a11ee commit dbe589b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/tests.yml
Expand Up @@ -75,3 +75,24 @@ jobs:
- name: Code coverage
run: codecov

# Run "pre-commit run --all-files --hook-stage=manual"
pre-commit:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: pre-commit/action@v2.0.0
with:
extra_args: --all-files --hook-stage=manual
- name: Help message if pre-commit fail
if: ${{ failure() }}
run: |
echo "You can install pre-commit hooks to automatically run formatting"
echo "on each commit with:"
echo " pre-commit install"
echo "or you can run by hand on staged files with"
echo " pre-commit run"
echo "or after-the-fact on already committed files with"
echo " pre-commit run --all-files --hook-stage=manual"
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
@@ -1,6 +1,3 @@
ci:
skip: [check-jsonschema]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
Expand Down Expand Up @@ -30,6 +27,7 @@ repos:
- id: isort
files: \.py$
args: [--profile=black]
stages: [manual]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.6.2
Expand All @@ -47,6 +45,7 @@ repos:
hooks:
- id: doc8
args: [--max-line-length=200]
stages: [manual]

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
Expand All @@ -58,6 +57,7 @@ repos:
"flake8-logging-format==0.6.0",
"flake8-implicit-str-concat==0.2.0",
]
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.14.2
Expand All @@ -67,3 +67,4 @@ repos:
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -62,6 +62,9 @@ hook with `pre-commit install`, you can fix everything up using
`pre-commit run --all-files`. You need to make the fixing commit
yourself after that.

Some of the hooks only run on CI by default, but you can invoke them by
running with the `--hook-stage manual` argument.

# Releasing

If you are going to release a version of `nbconvert` you should also be capable
Expand Down

0 comments on commit dbe589b

Please sign in to comment.