repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.3
    hooks:
      - id: ruff
        args:
          - --fix
      - id: ruff-format
        files: ^((supervisor|tests)/.+)?[^/]+\.py$
  - repo: https://github.com/codespell-project/codespell
    rev: v2.4.2
    hooks:
      - id: codespell
        args:
          - --ignore-words-list=astroid,hass
        exclude: ^supervisor/api/panel/
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: check-executables-have-shebangs
        stages: [manual]
      - id: check-json
  - repo: local
    hooks:
      # Run mypy through our wrapper script in order to get the possible
      # pyenv and/or virtualenv activated; it may not have been e.g. if
      # committing from a GUI tool that was not launched from an activated
      # shell.
      #
      # mypy is a whole-program checker, so run it against the entire
      # supervisor package (matching CI) in a single serial invocation rather
      # than against the changed files. See python/mypy#13916 for why running
      # mypy per-file under pre-commit is problematic.
      - id: mypy
        name: mypy
        entry: script/run-in-env.sh mypy supervisor
        language: script
        types_or: [python, pyi]
        files: ^supervisor/.+\.(py|pyi)$
        pass_filenames: false
        require_serial: true
