Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Question: Exclude Generated Header Files from clang-tidy Checks

Open
#302 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, python

Research direction

Start by reading the linked CMakeLists.txt and package.xml attachments, then inspect how the project configures its clang-tidy test and how generate_parameter_library() creates headers. The report identifies generated headers under the build directory, including scorpio_base_parameters.hpp, as the files triggering warnings. Done means clang-tidy still checks user source files but excludes generated headers.

Written by the indexing model from the issue text.

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 skipped

Here is my source files:

CMakeLists.txt
package.xml

---
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
...
Dominant language
Python
Stars
385
Forks
81
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PickNikRobotics/generate_parameter_library

All issues in PickNikRobotics/generate_parameter_library

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.