diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3e840b73..8fd63d410 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,28 +10,20 @@ concurrency: cancel-in-progress: true jobs: - # Run "pre-commit run --all-files" + # Run "pre-commit run --all-files --hook-stage=manual" pre-commit: name: Run pre-commit hook - runs-on: ubuntu-latest - timeout-minutes: 2 - - env: - PYTHON_VERSION: 3.8 - + timeout-minutes: 5 steps: - name: Checkout uses: actions/checkout@v2 - - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHON_VERSION }} - + - name: Set up Python + uses: actions/setup-python@v3 - name: Run pre-commit 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: | @@ -41,7 +33,7 @@ jobs: 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" + echo " pre-commit run --all-files --hook-stage=manual" build-n-test-n-coverage: name: Build, test and code coverage diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 894f9b84e..e4e445765 100644 --- a/.pre-commit-config.yaml +++ b/.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 @@ -34,6 +31,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,6 +48,7 @@ repos: "flake8-logging-format==0.6.0", "flake8-implicit-str-concat==0.2.0", ] + stages: [manual] - repo: https://github.com/PyCQA/doc8 rev: 0.11.1 @@ -59,3 +64,4 @@ repos: files: ^\.github/workflows/ types: [yaml] args: ["--schemafile", "https://json.schemastore.org/github-workflow"] + stages: [manual] diff --git a/README.md b/README.md index fe1940dcf..60d1a2a64 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ _file:///my/projects/jupyter_client/docs/\_build/html/index.html_ ## Contributing -jupyter-client has adopted automatic code formatting so you shouldn't +`jupyter-client` has adopted automatic code formatting so you shouldn't need to worry too much about your code style. As long as your code is valid, the pre-commit hook should take care of how it should look. @@ -76,3 +76,6 @@ If you have already committed files before setting up the pre-commit 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.