fail_fast: false

exclude: |
  (?x)^(
    .github/workflows/release.yml|
    ruff/.*|
    docs/reference/(cli|configuration|rules|environment).md
  )$

repos:
  # Priority 0: Read-only hooks; hooks that modify disjoint file types.
  - repo: https://github.com/astral-sh/uv-pre-commit
    rev: 0.11.6
    hooks:
      - id: uv-lock
        priority: 0

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-merge-conflict
        priority: 0

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.15.10
    hooks:
      - id: ruff-format
        priority: 0
      - id: ruff
        args: [--fix, --exit-non-zero-on-fix]
        types_or: [python, pyi]
        require_serial: true
        priority: 1

  - repo: https://github.com/abravalheri/validate-pyproject
    rev: v0.25
    hooks:
      - id: validate-pyproject
        priority: 0

  - repo: https://github.com/executablebooks/mdformat
    rev: 1.0.0
    hooks:
      - id: mdformat
        language: python # means renovate will also update `additional_dependencies`
        additional_dependencies:
          - mdformat-mkdocs==5.1.4
          - mdformat-footnote==0.1.3
        priority: 0

  - repo: https://github.com/igorshubovych/markdownlint-cli
    rev: v0.48.0
    hooks:
      - id: markdownlint-fix
        priority: 1

  - repo: https://github.com/crate-ci/typos
    rev: v1.45.0
    hooks:
      - id: typos
        priority: 0

  # Prettier
  - repo: https://github.com/rbubley/mirrors-prettier
    rev: v3.8.2
    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: v1.23.1
    hooks:
      - id: zizmor
        priority: 0

  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.11.0.1
    hooks:
      - id: shellcheck
        priority: 0

  - repo: https://github.com/python-jsonschema/check-jsonschema
    rev: 0.37.1
    hooks:
      - id: check-github-workflows
        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: 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 `uvx pre-commit run -a --hook-stage=manual`.
          # To run *just* this hook, use `uvx pre-commit run -a actionlint --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
