repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.3.0
    hooks:
      - id: check-merge-conflict
      - id: check-toml # For pyproject.toml
      - id: check-yaml # For workflows
        # Only parse the files for syntax, don't do full load.
        # We need this because of mkdocs.yml, which uses some custom tags to perform dynamic imports from python.
        args: ["--unsafe"]
      - id: end-of-file-fixer
      - id: trailing-whitespace
        args: [--markdown-linebreak-ext=md]
      - id: mixed-line-ending
        args: [--fix=lf]
      - id: sort-simple-yaml

  - repo: local
    hooks:
      - id: ruff-linter
        name: Ruff Linter
        description: Run ruff checks on the code
        entry: ruff check --force-exclude
        language: system
        types: [python]
        require_serial: true
        args: [--fix, --exit-non-zero-on-fix]

  - repo: local
    hooks:
      - id: ruff-formatter
        name: Ruff Formatter
        description: Ruf ruff auto-formatter
        entry: ruff format
        language: system
        types: [python]
        require_serial: true

  - repo: local
    hooks:
      - id: basedpyright
        name: Based Pyright
        description: Run basedpyright type checker
        entry: basedpyright --warnings
        language: system
        types: [python]
        pass_filenames: false # pyright runs for the entire project, it can't run for single files

  - repo: local
    hooks:
      - id: uv-lockfile
        name: UV Lockfile
        description: Check if the UV lockfile is up to date with pyproject.toml
        entry: uv lock --check
        language: system
        files: '^pyproject\.toml$|^uv\.lock$'
        pass_filenames: false