diff --git a/ament_clang_tidy/ament_clang_tidy/main.py b/ament_clang_tidy/ament_clang_tidy/main.py index c6fdbb62..1b3cdcdd 100755 --- a/ament_clang_tidy/ament_clang_tidy/main.py +++ b/ament_clang_tidy/ament_clang_tidy/main.py @@ -83,6 +83,10 @@ def main(argv=sys.argv[1:]): '--system-headers', action='store_true', help='Displays errors from all system headers') + parser.add_argument( + '--clang-tidy-version', + default='6.0', + help='The version of clang-tidy to use.') parser.add_argument( '--packages-select', nargs='*', metavar='PKG_NAME', help='Only process a subset of packages') @@ -113,8 +117,9 @@ def main(argv=sys.argv[1:]): bin_names = [ # 'clang-tidy', - 'clang-tidy-6.0', + 'clang-tidy-' + args.clang_tidy_version, ] + clang_tidy_bin = find_executable(bin_names) if not clang_tidy_bin: print('Could not find %s executable' % diff --git a/ament_clang_tidy/doc/index.rst b/ament_clang_tidy/doc/index.rst index 81fc2fc4..4e39397b 100644 --- a/ament_clang_tidy/doc/index.rst +++ b/ament_clang_tidy/doc/index.rst @@ -20,6 +20,7 @@ have already been installed. ``compile_commands.json`` files should have already [--export-fixes EXPORT_FIXES] [--fix-errors] [--header-filter HEADER_FILTER] [--quiet] [--system-headers] [--jobs N] + [--clang-tidy-version CLANG_TIDY_VERSION] [--packages-select [PKG_NAME [PKG_NAME ...]]] [--xunit-file XUNIT_FILE] [paths [paths ...]] @@ -53,6 +54,9 @@ files. The ``--jobs`` option will control the number of clang-tidy jobs to run in parallel. +The ``--clang-tidy-version`` enables you to set a different version of +clang-tidy to use. + The ``--packages-select`` option will filter the "compile_commands.json" files to just those generated by specific ROS packages.