repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: "v6.0.0"
    hooks:
      - id: check-added-large-files
        args: ["--maxkb=1024"]
      - id: check-case-conflict
      - id: check-merge-conflict
      - id: check-symlinks
      - id: check-yaml
        exclude: ^\.clang-format$ # check-yaml do not support multi-document file
      - id: debug-statements
        exclude: "Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleSyntaxErrorTestWidget.py|Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleSyntaxErrorTest.py"
      - id: end-of-file-fixer
        exclude: "\\.(md5|svg|vtk|vtp)$|^Resources\\/[^\\/]+\\.h$|\\/ColorFiles\\/.+\\.txt$|Data\\/Input\\/.+$"
      - id: mixed-line-ending
        exclude: "\\.(svg|vtk|vtp)$"
      - id: trailing-whitespace
        exclude: "\\.(svg|vtk|vtp)$"

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.15.17
    hooks:
      - id: ruff-check
        args: ["--fix", "--show-fixes"]

  - repo: https://github.com/pre-commit/mirrors-clang-format
    rev: "v22.1.5"
    hooks:
      - id: clang-format
        # For support of legacy code.  The Slicer core no longer has files with .txx extensions.
        # Explicitly include ".txx" files, which are not recognized as source files
        # by the "identify" package used by pre-commit. To work around this,
        # we manually specify file matching via the "files" regex and set "types_or"
        # to allow formatting of files treated as plain text.
        #
        # Reference: https://github.com/pre-commit/identify/blob/main/identify/extensions.py
        types_or: [file, text]
        files: \.(cpp|cxx|h|hpp|hxx|txx)$

  - repo: https://github.com/asottile/pyupgrade
    rev: v3.21.2
    hooks:
      - id: pyupgrade
        args: [--py312-plus]

  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: "v4.0.0-alpha.8"
    hooks:
      - id: prettier
        types_or: [yaml]

  - repo: https://github.com/python-jsonschema/check-jsonschema
    rev: "0.37.3"
    hooks:
      - id: check-dependabot
      - id: check-github-workflows
