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 #782

Merged
merged 2 commits into from
Apr 8, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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/[email protected]
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_and_examples:
name: Test Docs and Examples
timeout-minutes: 10
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/trigger_precommit.yml

This file was deleted.

7 changes: 4 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 @@ -47,6 +44,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,11 +56,13 @@ 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
Expand All @@ -72,3 +72,4 @@ repos:
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]
5 changes: 4 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ You can invoke the pre-commit hook by hand at any time with::

which should run any autoformatting on your code
and tell you about any errors it couldn't fix automatically.
You may also install [black integration](https://github.com/psf/black#editor-integration)
You may also install `black integration <https://github.com/psf/black#editor-integration>`_
into your text editor to format code automatically.

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.

Troubleshooting the Installation
--------------------------------

Expand Down