default_language_version:
  python: python3.12
ci:
  skip:
  - pylint
  - mypy
exclude: ^\.vscode/.*$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: c4a0b883114b00d8d76b479c820ce7950211c99b  # frozen: v4.5.0
  hooks:
  - id: trailing-whitespace
    args: ['--markdown-linebreak-ext=md,markdown']
  - id: end-of-file-fixer
  - id: check-yaml
  - id: check-added-large-files
  - id: check-ast
  - id: check-byte-order-marker
  - id: check-merge-conflict
  - id: debug-statements
  - id: detect-private-key
    exclude: tests/data/.*
  - id: check-builtin-literals
  - id: check-case-conflict
  - id: check-docstring-first
  - id: check-executables-have-shebangs
  - id: check-json
    exclude: '.devcontainer/.*'
  - id: pretty-format-json
    exclude: '.devcontainer/.*'
    args:
    - --indent
    - '4'
    - --autofix
    - --no-sort-keys
  - id: check-toml
  - id: fix-encoding-pragma
    args:
    - --remove
- repo: https://github.com/psf/black
  rev: 6fdf8a4af28071ed1d079c01122b34c5d587207a  # frozen: 24.2.0
  hooks:
  - id: black
- repo: https://github.com/pycqa/isort
  rev: c235f5e450b4b84e58d114ed4c589cbf454175a3  # frozen: 5.13.2
  hooks:
  - id: isort
- repo: https://github.com/pre-commit/pygrep-hooks
  rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316  # frozen: v1.10.0
  hooks:
  - id: python-no-eval
  - id: python-no-log-warn
- repo: https://github.com/asottile/pyupgrade
  rev: df17dfa3911b81b4a27190b0eea5b1debc7ffa0a  # frozen: v3.15.1
  hooks:
  - id: pyupgrade
    args:
    - "--py310-plus"

- repo: local
  hooks:
  - id: mypy
    name: mypy
    entry: uv run mypy
    args:
    - cloudbot
    - plugins
    - tests
    language: system
    types: [python]
    pass_filenames: false
    always_run: true
  - id: pylint
    name: pylint
    entry: uv run pylint
    args:
    - '-s'
    - 'no'
    - cloudbot
    - plugins
    - tests
    language: system
    types: [python]
    pass_filenames: false
    always_run: true
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
  rev: 8d1b9cadaf854cb25bb0b0f5870e1cc66a083d6b  # frozen: 0.2.3
  hooks:
  - id: yamlfmt
    args:
    - --mapping
    - '2'
    - --sequence
    - '2'
    - --offset
    - '0'
    - --width
    - '120'
    - -e
    - -p
- repo: https://github.com/antonbabenko/pre-commit-terraform
  rev: v1.96.2
  hooks:
  - id: terraform_fmt
    files: ^infra/terraform/.*\.tf$
  - id: terraform_validate
    files: ^infra/terraform/.*\.tf$
- repo: https://github.com/shellcheck-py/shellcheck-py
  rev: v0.10.0.1
  hooks:
  - id: shellcheck
    files: ^infra/terraform/.*\.sh$
