| Issue |
175188
|
| Summary |
clang-tidy ruleset per directory pattern
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
thorsten-klein
|
Hello,
In our company we organize our code as follows:
```
├── libA
│ ├── include
│ ├── src
│ └── test
└── libB
├── include
├── src
└── test
```
For our productive code we have aligned on specific clang-tidy checks.
Unfortunately, our tests are not compliant with these checks. For example we enable `cppcoreguidelines-avoid-magic-numbers` for productive code, but we cannot enable it for tests.
As a result in each test folder we now have a `.clang-tidy` file as follows:
```
├── .clang-tidy
├── libA
│ ├── include
│ ├── src
│ └── test
│ └── .clang-tidy
└── libB
├── include
├── src
└── test
└── .clang-tidy
```
The `test/.clang-tidy` looks as follows:
```
---
InheritParentConfig: true
Checks: >
-cppcoreguidelines-avoid-magic-numbers,
```
What could be some other mechanism so that we do not need to duplicate/symlink this file at that many places?
Maybe supporting "rulesets" could be an option, which can be applied per directory?
e.g. (simplified, in JSON format)
```
{
"Checks": ["*"],
"Rulesets": {
"our-tests" : {
"InheritParentConfig": "true",
"Checks": ["-cppcoreguidelines-avoid-magic-numbers"],
"Patterns": [".*/test/.*"]
},
"external-code" : {
"Checks": ["google*"],
"Patterns": [".*/external/.*"]
}
}
}
```
Maybe there is already some other solution existing, or you can think of any better?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs