repos:
  - repo: https://github.com/pre-commit/mirrors-clang-format
    rev: v16.0.0
    hooks:
      - id: clang-format
        types_or: [c++, c]
        files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx)$
        exclude: |
          (?x)^(
            docs
            | example
            | include/external/acl/(?:
              acl_prof
              | acl_rt
              | acl_rt_allocator
              | acl_tdt
              | acl_tdt_queue
            )\.h
            | include(?:
              /(?!
                (?:
                  external
                  | tsd_client
                )(?:/|$)
              )
              | $
            )
            | pkg_inc(?:
              /(?!
                (?:
                  aicpu_sched
                  | queue_schedule
                  | runtime
                  | tsd
                )(?:/|$)
              )
              | $
            )
            | scripts
            | src/(
              aicpu_sched
              | dfx
              | mmpa
              | platform
              | queue_schedule
            )(/|$)
            | stub
            | tests(?:
              /(?!
                (?:
                  cmodel_test
                  | depends/runtime
                  | depends/tdt
                  | ut/acl
                  | ut/aicpu_sched
                  | ut/queue_schedule
                  | ut/runtime
                  | ut/tsd
                )(?:/|$)
                | depends/acl_stub\.h$
              )
              | $
            )
          )
        args:
          - "--style=file"
          - "--verbose"
          - "-i"


  # OAT compliance check (Open Source Audit Tool)
  - repo: local
    hooks:
      - id: oat-check
        name: OAT Compliance Check
        entry: bash scripts/oat_check.sh
        exclude: .pre-commit-config.yaml
        language: system
        pass_filenames: true
        types: [file]
        stages: [commit]
        verbose: true