I use clang-tidy
to lint project code. The project uses third-party headers, e.g. from cmake generated protobuf files like logger.pb.h
. I only want to lint project specific source file and want to handle third-party headers as system headers, therefor i use -isystem
.
My project tree looks like:
source
└── logger.cpp
dependencies
└── include
├── logger.pb.h
└── queue.h
Since i use a dynamic script i have a mix by using a .clang-tidy
config file and i call this
clang-tidy -export-fixes=fixes.txt /path/to/logger.cpp -- -isystem /path/to/dependencies/include
with the config-file .clang-tidy
:
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,readability-identifier-naming'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- { key: readability-identifier-naming.AbstractClassCase, value: CamelCase }
- { key: readability-identifier-naming.AbstractClassPrefix, value: Abstrac }
... more keys ...
clang-tidy
shows errors in my source file logger.cpp
as expected. But it also complains about the third party headers i use and i don't know how to get rid of:
path/to/dependencies/include/logger.pb.h:263:57: warning: invalid case style for private member '_cached_size_' [readability-identifier-naming]
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
^~~~~~~~~~~~~
_cachedSize
path/to/source/logger.cpp:26:11: warning: invalid case style for local pointer 'MyVar' [readability-identifier-naming]
char *MyVar;
^~~~~
myVar
Suppressed 24721 warnings (24717 in non-user code, 4 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
PS:
i also tried:
-I /path/to/dependencies/include
-isystem=/path/to/dependencies/include