default_language_version:
  python: python3

exclude: |
  (?x)^(
    gdextension/extension_api\.json|
    gdextension/gdextension_interface\.json
  )$

repos:
  - repo: https://github.com/pre-commit/mirrors-clang-format
    rev: v20.1.0
    hooks:
      - id: clang-format

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.11.4
    hooks:
      - id: ruff
        args: [--fix]
        files: (\.py|SConstruct)$
        types_or: [text]
      - id: ruff-format
        files: (\.py|SConstruct)$
        types_or: [text]

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.14.1 # Latest version that supports Python 3.8
    hooks:
      - id: mypy
        files: \.py$
        types_or: [text]

  - repo: https://github.com/codespell-project/codespell
    rev: v2.4.1
    hooks:
      - id: codespell
        additional_dependencies: [tomli]

  - repo: https://github.com/BlankSpruce/gersemi
    rev: 0.19.2
    hooks:
      - id: gersemi
        args: ["-i", "--no-warn-about-unknown-commands", "-l", "120"]

  - repo: local
    hooks:
      - id: copyright-headers
        name: copyright-headers
        language: python
        entry: python misc/scripts/copyright_headers.py
        files: \.(c|h)pp$
        exclude: ^test/

      - id: header-guards
        name: header-guards
        language: python
        entry: python misc/scripts/header_guards.py
        files: \.hpp$
        exclude: ^test/

      - id: file-format
        name: file-format
        language: python
        entry: python misc/scripts/file_format.py
        types_or: [text]

      - id: check-get-file-list
        name: check-get-file-list
        language: python
        entry: python misc/scripts/check_get_file_list.py
        pass_filenames: false
        always_run: true
        stages: [manual]
