Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up pre-commit #768

Merged
merged 2 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 7 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down
12 changes: 9 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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 @@ -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:
Expand All @@ -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
Expand All @@ -59,3 +64,4 @@ repos:
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.