# pre-commit is a tool to perform a predefined set of tasks manually and/or
# automatically before git commits are made.
#
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
#
# Common tasks
#
# - Register git hooks: pre-commit install --install-hooks
# - Run on all files:   pre-commit run --all-files

# We run pre-commit as part of our CI and run scheduled updates
ci:
  autoupdate_schedule: monthly
  autofix_commit_msg: |
    [pre-commit.ci] Apply automatic pre-commit fixes

repos:
  # general
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.6.0
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace
      - id: check-toml
      - id: check-yaml

  # python
  - repo: https://github.com/psf/black
    rev: 24.4.2
    hooks:
      - id: black
        exclude: ^test/scripts/

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.4.3
    hooks:
      - id: ruff

  - repo: https://github.com/pycqa/isort
    rev: 5.13.2
    hooks:
      - id: isort
        name: isort
        additional_dependencies: [toml]
        files: \.py$

  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v4.0.0-alpha.8
    hooks:
      - id: prettier
        types_or: [css, markdown, html]
