Merge pull request #9504 from sbidoul/improve-pre-commit-sbi

Better way to run slow linters in CI only
This commit is contained in:
Stéphane Bidoul 2021-01-26 09:30:34 +01:00 committed by GitHub
commit fa0ee31f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 19 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

@ -2,7 +2,7 @@ exclude: 'src/pip/_vendor/'
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0 rev: v3.4.0
hooks: hooks:
- id: check-builtin-literals - id: check-builtin-literals
- id: check-added-large-files - id: check-added-large-files
@ -53,7 +53,7 @@ repos:
- repo: https://gitlab.com/pycqa/flake8 - repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3 rev: 3.8.4
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: [ additional_dependencies: [
@ -63,20 +63,20 @@ repos:
exclude: tests/data exclude: tests/data
- repo: https://github.com/PyCQA/isort - repo: https://github.com/PyCQA/isort
rev: 5.5.3 rev: 5.7.0
hooks: hooks:
- id: isort - id: isort
files: \.py$ files: \.py$
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790 rev: v0.800
hooks: hooks:
- id: mypy - id: mypy
exclude: docs|tests exclude: docs|tests
args: ["--pretty"] args: ["--pretty"]
- repo: https://github.com/pre-commit/pygrep-hooks - repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.6.0 rev: v1.7.0
hooks: hooks:
- id: python-no-log-warn - id: python-no-log-warn
- id: python-no-eval - id: python-no-eval
@ -93,3 +93,9 @@ repos:
entry: NEWS fragment files must be named *.(process|removal|feature|bugfix|vendor|doc|trivial).rst 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) exclude: ^news/(.gitignore|.*\.(process|removal|feature|bugfix|vendor|doc|trivial).rst)
files: ^news/ 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 .travis.yml
exclude .readthedocs.yml exclude .readthedocs.yml
exclude .pre-commit-config.yaml exclude .pre-commit-config.yaml
exclude .pre-commit-config-slow.yaml
exclude tox.ini exclude tox.ini
exclude noxfile.py exclude noxfile.py

View File

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

View File

@ -8,7 +8,7 @@ import os.path
import site import site
import sys import sys
import sysconfig import sysconfig
from distutils.command.install import SCHEME_KEYS # type: ignore from distutils.command.install import SCHEME_KEYS
from distutils.command.install import install as distutils_install_command from distutils.command.install import install as distutils_install_command
from pip._internal.models.scheme import Scheme from pip._internal.models.scheme import Scheme

View File

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