diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6c216b46..151dd3e9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,26 @@ jobs: run: | codecov + pre-commit: + name: pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - 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" + test_docs: runs-on: ${{ matrix.os }} strategy: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1b3593a7..c121ded00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,13 @@ repos: hooks: - id: prettier + - repo: https://github.com/PyCQA/doc8 + rev: 0.11.1 + hooks: + - id: doc8 + args: [--max-line-length=200] + stages: [manual] + - repo: https://github.com/pycqa/flake8 rev: 4.0.1 hooks: @@ -44,8 +51,20 @@ repos: "flake8-logging-format==0.6.0", "flake8-implicit-str-concat==0.2.0", ] + stages: [manual] - repo: https://github.com/pre-commit/mirrors-eslint rev: v8.12.0 hooks: - id: eslint + stages: [manual] + + - repo: https://github.com/sirosen/check-jsonschema + rev: 0.14.2 + hooks: + - id: check-jsonschema + name: "Check GitHub Workflows" + files: ^\.github/workflows/ + types: [yaml] + args: ["--schemafile", "https://json.schemastore.org/github-workflow"] + stages: [manual] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e54fe77f5..5091d692d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,6 +42,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 ipykernel Releasing ipykernel is _almost_ standard for a Python package: