repos:
  - repo: https://gitcode.com/openUBMC/pre-commit-hooks
    rev: 0.1.2
    hooks:
      - id: conventional-commit
      - id: add-signoff-and-change-id
      - id: check-sr
      - id: check-json
      - id: check-yaml

      # --- C/C++ 格式化 ---
      # clang-format 使用 -style=file,依赖项目根目录的 .clang-format 文件。
      # 若缺失该文件,clang-format 会按 --fallback-style=LLVM 静默格式化,
      # 配合 -i 会原地改写 C/C++ 文件,可能导致不符合预期的格式变更。
      - id: clang-format
        types_or: [c++, c]

      # --- Lua 格式化与检查 ---
      - id: stylua-format
        args: ['--config-path', '.stylua.toml']
        exclude: '^gen/'
      - id: luacheck
        args: ['--config', '.luacheckrc']
        exclude: '^gen/'

  - repo: https://gitcode.com/gh_mirrors/pr/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: trailing-whitespace
        exclude: '(\.vscode/|multi-user\.target\.wants/)'
      - id: end-of-file-fixer
        exclude: '(\.vscode/|multi-user\.target\.wants/)'
      - id: check-merge-conflict
      - id: check-added-large-files
        args: [--maxkb, "1024"]
      - id: check-case-conflict
      - id: detect-private-key