Skip to content

clang-tidy file exclude pattern ignored #51

Open
@KaDw

Description

@KaDw

Hi,

I would like to run all of the hooks only on specific directories. To achieve this I'm using file exclude pattern. The exclude works for the clang-format but not for the clang-tidy (for example it reports errors in Utilities directory with manufacturer files). Basically clang-tidy takes all files.

How I can make the exclude pattern work for clang-tidy also? I saw files: .*\.c option but I would have to repeat the excludes in - id: clang-tidyhook

PS. I noticed cpplint also runs on all the files and ignores file exclude pattern

Here is my config file:

exclude: |
  (?x)^(
      .vscode/.*|
      Core/.*|
      Drivers/.*|
      LoRaWAN/.*|
      Middlewares/Third_Party/.*|
      Utilities/.*|
      config/.*|
      ^.*\.(svd|ld)|
      .mxproject
  )$

repos:
  - repo: local
    hooks:
      - id: compiledb
        name: compiledb
        entry: compiledb
        language: system
        args: [--overwrite, make, -n, -B]
        always_run: true
        require_serial: true
        pass_filenames: false

  - repo: https://github.com/pre-commit/mirrors-clang-format
    rev: v14.0.6
    hooks:
      - id: clang-format

  - repo: https://github.com/pocc/pre-commit-hooks
    rev: v1.3.5
    hooks:
      - id: cpplint
      - id: clang-tidy
        args: [-checks=clang-diagnostic-return-type]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions