default_language_version:
  python: python3

ci:
  autofix_prs: true
  autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions"
  # submodules: true

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace
        exclude: README.md
      - id: check-case-conflict
      - id: check-yaml
      - id: check-toml
      - id: check-json
      - id: check-added-large-files
        args: ["--maxkb=400", "--enforce-all"]
        exclude: notebooks
      - id: check-docstring-first
      - id: detect-private-key

  - repo: https://github.com/asottile/pyupgrade
    rev: v3.21.0
    hooks:
      - id: pyupgrade
        args: ["--py310-plus"]
        name: Upgrade code
        language_version: python3.13
        exclude: "examples|thunder/tests/test_interpreter.py|thunder/tests/test_jit_general.py"

  - repo: https://github.com/codespell-project/codespell
    rev: v2.4.1
    hooks:
      - id: codespell
        additional_dependencies: [tomli]
        #args: ["--write-changes"] # uncomment if you want to get automatic fixing

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.0
    hooks:
      - id: ruff-check
        args: ["--fix"]
      - id: ruff-format
        types_or: [python]
        exclude: "examples"

  - repo: https://github.com/executablebooks/mdformat
    rev: 0.7.22
    hooks:
      - id: mdformat
        additional_dependencies:
          - mdformat-gfm
          - mdformat-black
          - mdformat_frontmatter
        exclude: "examples"

  - repo: https://github.com/sphinx-contrib/sphinx-lint
    rev: v1.0.0
    hooks:
      - id: sphinx-lint

  - repo: https://github.com/JoC0de/pre-commit-prettier
    rev: b3e25fa39aa676c36bc18eb9eae6f26d9bb63f39 # v3.6.2 using SHA as tags are not persistent
    hooks:
      - id: prettier
        files: \.(json|yml|yaml|toml)
        # https://prettier.io/docs/en/options.html#print-width
        args: ["--print-width=120"]
