minimum_pre_commit_version: 3.2.0
default_stages: [pre-commit]
default_install_hook_types: [pre-commit, pre-push]
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: mixed-line-ending
        args: [--fix=lf]
      - id: check-yaml
      - id: check-json
        exclude: ^scoop/gc\.json$
      - id: check-toml
      - id: check-merge-conflict
      - id: check-added-large-files
        args: [--maxkb=512]
        stages: [pre-commit, pre-push]
      - id: detect-private-key
        stages: [pre-commit, pre-push]

  - repo: local
    hooks:
      - id: gofmt
        name: gofmt
        entry: gofmt -w
        language: system
        types: [go]
      - id: gitleaks
        name: gitleaks (workspace, incl gitignored)
        entry: gitleaks detect --source . --no-git --no-banner --redact=100 --verbose --config .gitleaks.toml
        language: system
        pass_filenames: false
        stages: [pre-commit, pre-push]
      - id: gitleaks-history
        name: gitleaks (git history)
        entry: gitleaks detect --source . --no-banner --redact=100 --verbose --config .gitleaks.toml
        language: system
        pass_filenames: false
        stages: [pre-push]