# Run on stage pre-commit by default,
# while enable action to run on stage commit-msg if chosen
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [pre-commit]

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.6.0
    hooks:
      - id: check-added-large-files
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-json
      - id: check-merge-conflict
      - id: check-shebang-scripts-are-executable
        exclude: '.*\.rs$'
      - id: check-symlinks
      - id: check-toml
      - id: check-vcs-permalinks
      - id: check-xml
      - id: check-yaml
      - id: debug-statements
      - id: destroyed-symlinks
      - id: detect-aws-credentials
        args: [--allow-missing-credentials]
      - id: detect-private-key
      - id: end-of-file-fixer
      - id: fix-byte-order-marker
      - id: mixed-line-ending
      - id: pretty-format-json
        args: [--autofix]
      - id: trailing-whitespace

  - repo: https://github.com/crate-ci/typos
    rev: v1.23.6
    hooks:
      - id: typos

  - repo: https://github.com/doublify/pre-commit-rust
    rev: v1.0
    hooks:
      - id: fmt
      - id: cargo-check
        args: ['--workspace']
      - id: clippy
        args: ['--workspace', '--', '-D', 'warnings']

  - repo: https://github.com/commitizen-tools/commitizen
    rev: v3.29.0
    hooks:
      - id: commitizen
