Better way to run slow linters in CI only

Taking advantage of pre-commit's manual stage.
This commit is contained in:
Stéphane Bidoul 2021-01-24 15:39:51 +01:00
parent e25b183459
commit fe3aec0f5e
No known key found for this signature in database
GPG Key ID: BCAB2555446B5B92
5 changed files with 8 additions and 13 deletions

View File

@ -1,7 +0,0 @@
# Slow pre-commit checks we don't want to run locally with each commit.
repos:
- repo: https://github.com/mgedmin/check-manifest
rev: '0.43'
hooks:
- id: check-manifest

View File

@ -93,3 +93,9 @@ repos:
entry: NEWS fragment files must be named *.(process|removal|feature|bugfix|vendor|doc|trivial).rst
exclude: ^news/(.gitignore|.*\.(process|removal|feature|bugfix|vendor|doc|trivial).rst)
files: ^news/
- repo: https://github.com/mgedmin/check-manifest
rev: '0.46'
hooks:
- id: check-manifest
stages: [manual]

View File

@ -17,7 +17,6 @@ exclude .appveyor.yml
exclude .travis.yml
exclude .readthedocs.yml
exclude .pre-commit-config.yaml
exclude .pre-commit-config-slow.yaml
exclude tox.ini
exclude noxfile.py

View File

@ -147,11 +147,9 @@ def lint(session):
args = session.posargs + ["--all-files"]
else:
args = ["--all-files", "--show-diff-on-failure"]
args.append("--hook-stage=manual")
session.run("pre-commit", "run", *args)
session.run(
"pre-commit", "run", "-c", ".pre-commit-config-slow.yaml", *args
)
@nox.session

View File

@ -63,8 +63,7 @@ skip_install = True
commands_pre =
deps = pre-commit
commands =
pre-commit run [] --all-files --show-diff-on-failure
pre-commit run [] -c .pre-commit-config-slow.yaml --all-files --show-diff-on-failure
pre-commit run [] --all-files --show-diff-on-failure --hook-stage=manual
[testenv:vendoring]
basepython = python3