mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-04 09:02:46 +08:00
Rework our linting setup (#11522)
Co-authored-by: Avasam <samuel.06@hotmail.com>
This commit is contained in:
@@ -8,17 +8,30 @@ repos:
|
||||
- id: check-toml
|
||||
- id: check-merge-conflict
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
- id: check-case-conflict
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.3.0 # must match requirements-tests.txt
|
||||
hooks:
|
||||
- id: ruff
|
||||
name: Run ruff on stubs, tests and scripts
|
||||
args: ["--exit-non-zero-on-fix"]
|
||||
- id: ruff
|
||||
# Run this separately because we don't really want
|
||||
# to use --unsafe-fixes for all rules
|
||||
name: Remove unnecessary `sys.version_info` blocks
|
||||
args: ["--exit-non-zero-on-fix", "--select=UP036", "--unsafe-fixes"]
|
||||
- id: ruff
|
||||
# Very few rules are useful to run on our test cases;
|
||||
# we explicitly enumerate them here:
|
||||
name: Run ruff on the test cases
|
||||
args: ["--exit-non-zero-on-fix", "--select=FA,I", "--no-force-exclude", "--unsafe-fixes"]
|
||||
files: '.*test_cases/.+\.py$'
|
||||
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||
rev: 24.1.1 # must match requirements-tests.txt
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.10
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.2.1 # must match requirements-tests.txt and tests.yml
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--exit-non-zero-on-fix, --fix-only]
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: 7.0.0 # must match requirements-tests.txt
|
||||
hooks:
|
||||
@@ -28,11 +41,13 @@ repos:
|
||||
- "flake8-pyi==24.1.0" # must match requirements-tests.txt
|
||||
types: [file]
|
||||
types_or: [python, pyi]
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: check-hooks-apply
|
||||
|
||||
ci:
|
||||
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
|
||||
autofix_prs: true
|
||||
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
|
||||
autoupdate_schedule: quarterly
|
||||
skip: [flake8]
|
||||
submodules: false
|
||||
|
||||
Reference in New Issue
Block a user