Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy file exclude pattern ignored #51

Open
KaDw opened this issue Nov 1, 2022 · 0 comments
Open

clang-tidy file exclude pattern ignored #51

KaDw opened this issue Nov 1, 2022 · 0 comments

Comments

@KaDw
Copy link

KaDw commented Nov 1, 2022

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]
@KaDw KaDw changed the title clang-tidy file exclude pattern clang-tidy file exclude pattern ignored Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant