-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
When using the generate_parameter_library tool in a ROS2 project, the generated header files (e.g., those created by generate_parameter_library() in CMake) are being included in clang-tidy static analysis checks. This is problematic because these files are auto-generated and not part of the user's source code, leading to unnecessary warnings or errors that clutter the output and make it harder to focus on actual code quality issues in the developer's own files.
I would like to exclude these generated header files from clang-tidy checks while still allowing clang-tidy to analyze the rest of the codebase.
Has anyone attempted to solve this issue?
❯ colcon test-result --verbose
build/scorpio_base/Testing/20251220-0855/Test.xml: 2 tests, 0 errors, 1 failure, 0 skipped
- clang_tidy
<<< failure message
-- run_test.py: invoking following command in '/home/lihanchen/Downloads/tmp/src':
- /opt/ros/humble/bin/ament_clang_tidy --xunit-file /home/lihanchen/Downloads/tmp/build/scorpio_base/test_results/scorpio_base/clang_tidy.xunit.xml /home/lihanchen/Downloads/tmp/build/scorpio_base --config /home/lihanchen/Downloads/tmp/src/.clang-tidy
found compilation database for package "scorpio_base"...
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:108:15: warning: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg]
logger_{std::move(logger)} {
^~~~~~~~~~ ~
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:120:12: warning: invalid case style for method 'get_params' [readability-identifier-naming]
Params get_params() const{
^~~~~~~~~~
getParams
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:131:10: warning: invalid case style for method 'try_update_params' [readability-identifier-naming]
bool try_update_params(Params & params_in) const {
^~~~~~~~~~~~~~~~~
tryUpdateParams
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:149:10: warning: invalid case style for method 'try_get_params' [readability-identifier-naming]
bool try_get_params(Params & params_in) const {
^~~~~~~~~~~~~~
tryGetParams
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:160:10: warning: invalid case style for method 'is_old' [readability-identifier-naming]
bool is_old(Params const& other) const {
^~~~~~
isOld
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:165:17: warning: invalid case style for method 'get_stack_params' [readability-identifier-naming]
StackParams get_stack_params() {
^~~~~~~~~~~~~~~~
getStackParams
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:177:10: warning: invalid case style for method 'refresh_dynamic_parameters' [readability-identifier-naming]
void refresh_dynamic_parameters() {
^~~~~~~~~~~~~~~~~~~~~~~~~~
refreshDynamicParameters
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:276:10: warning: invalid case style for method 'declare_params' [readability-identifier-naming]
void declare_params(){
^~~~~~~~~~~~~~
declareParams
/home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:439:12: warning: invalid case style for method 'update_internal_params' [readability-identifier-naming]
void update_internal_params(Params updated_params) {
^~~~~~~~~~~~~~~~~~~~~~
updateInternalParams
-- run_test.py: return code 0
-- run_test.py: verify result file '/home/lihanchen/Downloads/tmp/build/scorpio_base/test_results/scorpio_base/clang_tidy.xunit.xml'
>>>
build/scorpio_base/test_results/scorpio_base/clang_tidy.xunit.xml: 14 tests, 0 errors, 9 failures, 0 skipped
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:108:15
<<< failure message
ove() as a const reference argument; no move will actually happen [performance-move-const-arg]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:120:12
<<< failure message
invalid case style for method 'get_params' [readability-identifier-naming]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:131:10
<<< failure message
invalid case style for method 'try_update_params' [readability-identifier-naming]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:149:10
<<< failure message
invalid case style for method 'try_get_params' [readability-identifier-naming]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:160:10
<<< failure message
invalid case style for method 'is_old' [readability-identifier-naming]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:165:17
<<< failure message
invalid case style for method 'get_stack_params' [readability-identifier-naming]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:177:10
<<< failure message
invalid case style for method 'refresh_dynamic_parameters' [readability-identifier-naming]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:276:10
<<< failure message
invalid case style for method 'declare_params' [readability-identifier-naming]
>>>
- scorpio_base.clang_tidy /home/lihanchen/Downloads/tmp/build/scorpio_base/include/scorpio_base/scorpio_base_parameters.hpp:439:12
<<< failure message
invalid case style for method 'update_internal_params' [readability-identifier-naming]
>>>
Summary: 23 tests, 0 errors, 10 failures, 0 skippedHere is my source files:
---
Checks: '-*,
performance-*,
-performance-unnecessary-value-param,
llvm-namespace-comment,
modernize-redundant-void-arg,
modernize-use-nullptr,
modernize-use-default,
modernize-use-override,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
misc-unused-parameters,
readability-named-parameter,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-simplify-boolean-expr,
readability-container-size-empty,
readability-identifier-naming,
'
HeaderFilterRegex: ''
CheckOptions:
- key: llvm-namespace-comment.ShortNamespaceLines
value: '10'
- key: llvm-namespace-comment.SpacesBeforeComments
value: '2'
- key: misc-unused-parameters.StrictMode
value: '1'
- key: readability-braces-around-statements.ShortStatementLines
value: '2'
# type names
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.UnionCase
value: CamelCase
# method names
- key: readability-identifier-naming.MethodCase
value: camelBack
# variable names
- key: readability-identifier-naming.VariableCase
value: lower_case
# class member names
- key: readability-identifier-naming.PrivateMemberCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberSuffix
value: '_'
- key: readability-identifier-naming.ProtectedMemberCase
value: lower_case
- key: readability-identifier-naming.ProtectedMemberSuffix
value: '_'
# const static or global variables are UPPER_CASE
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.StaticConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.ClassConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.GlobalVariableCase
value: UPPER_CASE
...Metadata
Metadata
Assignees
Labels
No labels