From 8aaceb66e6096a4685d9e97d511ca9acc178884e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 7 Apr 2022 21:38:57 -0500 Subject: [PATCH 1/2] clean up pre-commit --- .github/workflows/main.yml | 2 +- .pre-commit-config.yaml | 12 +++++++++--- README.md | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3e840b73..35e9d7bc2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,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. From 91cba5e3a8c7e9261c753407cf7a4ddd313c0e24 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 8 Apr 2022 03:54:10 -0500 Subject: [PATCH 2/2] clean up pre-commit in ci --- .github/workflows/main.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 35e9d7bc2..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: |