mirror of
https://github.com/astral-sh/ruff.git
synced 2026-10-28 10:45:37 +08:00
167 lines
6.2 KiB
YAML
167 lines
6.2 KiB
YAML
fail_fast: false
|
|
|
|
exclude: |
|
|
(?x)^(
|
|
crates/ty_vendored/vendor/.*|
|
|
crates/ty_project/resources/.*|
|
|
crates/ty/docs/(configuration|rules|cli|environment).md|
|
|
crates/ruff_benchmark/resources/.*|
|
|
crates/ruff_linter/resources/(?!mdtest/).*|
|
|
crates/ruff_linter/src/rules/.*/snapshots/.*|
|
|
crates/ruff_notebook/resources/.*|
|
|
crates/ruff_server/resources/.*|
|
|
crates/ruff/resources/.*|
|
|
crates/ruff_python_formatter/resources/.*|
|
|
crates/ruff_python_formatter/tests/snapshots/.*|
|
|
crates/ruff_python_resolver/resources/.*|
|
|
crates/ruff_python_resolver/tests/snapshots/.*|
|
|
crates/ty_completion_eval/truth/.*
|
|
)$
|
|
|
|
repos:
|
|
# Priority 0: Read-only hooks; hooks that modify disjoint file types.
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
|
|
hooks:
|
|
- id: check-merge-conflict
|
|
priority: 0
|
|
- id: end-of-file-fixer
|
|
# Don't run this on all files: the absence of trailing newlines is often
|
|
# intentional in parser/linter/formatter tests
|
|
files: '^((crates/ty_python_semantic/resources/corpus/.*)|(.*\.toml))$'
|
|
priority: 0
|
|
|
|
- repo: https://github.com/abravalheri/validate-pyproject
|
|
rev: 17e12779811926f000bdfa1795f9e3735dd71ac3 # frozen: 0.26
|
|
hooks:
|
|
- id: validate-pyproject
|
|
priority: 0
|
|
|
|
- repo: https://github.com/crate-ci/typos
|
|
rev: 512fc24f32f44ab01972217aaaf3dc86ec234d53 # frozen: v1.50.2
|
|
hooks:
|
|
- id: typos
|
|
priority: 0
|
|
|
|
- repo: local
|
|
hooks:
|
|
- id: rustfmt
|
|
name: rustfmt
|
|
entry: rustfmt
|
|
language: system
|
|
types: [rust]
|
|
priority: 0
|
|
# Prettier
|
|
- repo: https://github.com/rbubley/mirrors-prettier
|
|
rev: 5c9b20b95f2bc1c4d3d929b83a96d5c96a29e752 # frozen: v3.9.8
|
|
hooks:
|
|
- id: prettier
|
|
types: [yaml]
|
|
priority: 0
|
|
|
|
# zizmor detects security vulnerabilities in GitHub Actions workflows.
|
|
# Additional configuration for the tool is found in `.github/zizmor.yml`
|
|
- repo: https://github.com/zizmorcore/zizmor-pre-commit
|
|
rev: fa412071e4f5d44d44f9e365f4676f9df92456a2 # frozen: v1.30.1
|
|
hooks:
|
|
- id: zizmor
|
|
priority: 0
|
|
|
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
rev: 12e63946db2c5cfcc9030fac21c3883ba88c6ed8 # frozen: 0.38.0
|
|
hooks:
|
|
- id: check-github-workflows
|
|
# The bundled schema predates GitHub's cache-mode feature. Use a pinned
|
|
# upstream schema until check-jsonschema includes it in a release.
|
|
entry: >-
|
|
check-jsonschema --schemafile
|
|
https://raw.githubusercontent.com/SchemaStore/schemastore/a1bfb2b17627062b6a938153c065cb58baef6fe7/src/schemas/json/github-workflow.json
|
|
priority: 0
|
|
|
|
# `actionlint` hook, for verifying correct syntax in GitHub Actions workflows.
|
|
# Some additional configuration for `actionlint` can be found in `.github/actionlint.yaml`.
|
|
- repo: https://github.com/rhysd/actionlint
|
|
rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12
|
|
hooks:
|
|
- id: actionlint
|
|
stages:
|
|
# This hook is disabled by default, since it's quite slow.
|
|
# To run all hooks *including* this hook, use `uv run --only-group dev --locked prek run --all-files --hook-stage=manual`.
|
|
# To run *just* this hook, use `uv run --only-group dev --locked prek run actionlint --all-files --hook-stage=manual`.
|
|
- manual
|
|
args:
|
|
- "-ignore=SC2129" # ignorable stylistic lint from shellcheck
|
|
- "-ignore=SC2016" # another shellcheck lint: seems to have false positives?
|
|
language: golang # means renovate will also update `additional_dependencies`
|
|
additional_dependencies:
|
|
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions
|
|
# and checks these with shellcheck. This is arguably its most useful feature,
|
|
# but the integration only works if shellcheck is installed
|
|
- "github.com/wasilibs/go-shellcheck/cmd/shellcheck@v0.11.1"
|
|
priority: 0
|
|
|
|
- repo: https://github.com/executablebooks/mdformat
|
|
rev: 82912cdaea4fb830f751504486a7879c70526547 # frozen: 1.0.0
|
|
hooks:
|
|
- id: mdformat
|
|
language: python # means renovate will also update `additional_dependencies`
|
|
additional_dependencies:
|
|
- mdformat-mkdocs==5.3.0
|
|
- mdformat-footnote==0.1.3
|
|
exclude: |
|
|
(?x)^(
|
|
\.agents/skills/.*
|
|
| docs/formatter/black\.md
|
|
| docs/\w+\.md
|
|
)$
|
|
priority: 0
|
|
|
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
rev: eeca16c54e09b4d9a848259e46bae14737944348 # frozen: 0.13.5
|
|
hooks:
|
|
- id: uv-lock
|
|
priority: 0
|
|
args: [--default-index=https://pypi.org/simple, --check, --refresh]
|
|
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: 38bfb07c0c64c304f47eb52090f8288150c77730 # frozen: v0.17.1
|
|
hooks:
|
|
- id: ruff-format
|
|
types_or: [python, pyi, jupyter]
|
|
exclude: crates/ty_python_semantic/resources/corpus/
|
|
priority: 0
|
|
|
|
# Priority 1: Second-pass fixers (e.g., markdownlint-fix runs after mdformat).
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: 38bfb07c0c64c304f47eb52090f8288150c77730 # frozen: v0.17.1
|
|
hooks:
|
|
- id: ruff-check
|
|
args: [--fix, --exit-non-zero-on-fix]
|
|
types_or: [python, pyi]
|
|
exclude: crates/ty_python_semantic/resources/corpus/
|
|
require_serial: true
|
|
priority: 1
|
|
|
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
rev: 5b5dddc4fb0f83c3ea1fc5616fa63e115dce83e0 # frozen: v0.49.1
|
|
hooks:
|
|
- id: markdownlint-fix
|
|
exclude: |
|
|
(?x)^(
|
|
\.agents/skills/.*
|
|
| docs/formatter/black\.md
|
|
| docs/\w+\.md
|
|
)$
|
|
priority: 1
|
|
|
|
# Priority 2: ruffen-docs runs after markdownlint-fix (both modify markdown).
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: 38bfb07c0c64c304f47eb52090f8288150c77730 # frozen: v0.17.1
|
|
hooks:
|
|
- id: ruff-format
|
|
name: mdtest format
|
|
types_or: [markdown]
|
|
files: '^crates/.*/resources/(mdtest|lint_docs)/.*\.md$'
|
|
pass_filenames: true
|
|
priority: 2
|