repos:
- repo: local
  hooks:
    # ensure pixi environments are up to date
    # workaround for https://github.com/prefix-dev/pixi/issues/1482
  - id: pixi-install
    name: Update pixi lint environment
    entry: pixi install -e default -e lint
    pass_filenames: false
    language: system
    always_run: true
    require_serial: true

  # pre-commit-hooks
  - id: trailing-whitespace-fixer
    name: Fix trailing whitespace with pre-commit-hooks
    entry: pixi run -e lint trailing-whitespace-fixer
    language: system
    types: [text]

  # pre-commit-hooks
  - id: end-of-file-fixer
    name: Fix end-of-file with pre-commit-hooks
    entry: pixi run -e lint end-of-file-fixer
    language: system
    types: [text]

  - id: ruff-check
    name: Lint with ruff
    entry: pixi run -e lint ruff check --force-exclude --fix
    language: system
    types_or: [python, pyi, jupyter]
    require_serial: true

  - id: ruff-format
    name: Format with ruff
    entry: pixi run -e lint ruff format --force-exclude
    language: system
    types_or: [python, pyi, jupyter]
    require_serial: true

  - id: mdformat
    name: Format markdown with mdformat
    entry: pixi run -e lint mdformat
    language: system
    types: [markdown]

  - id: taplo
    name: Format TOML with taplo
    entry: pixi run -e lint taplo fmt
    language: system
    types: [toml]
