File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
ament_cmake_cppcheck/cmake
ament_cppcheck/ament_cppcheck Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 3535# @public
3636#
3737function (ament_cppcheck)
38- cmake_parse_arguments (ARG "" "LANGUAGE;TESTNAME" "EXCLUDE;LIBRARIES;INCLUDE_DIRS" ${ARGN} )
38+ cmake_parse_arguments (ARG "" "ENABLE_EXTRA_CHECKS; LANGUAGE;TESTNAME" "EXCLUDE;LIBRARIES;INCLUDE_DIRS" ${ARGN} )
3939 if (NOT ARG_TESTNAME)
4040 set (ARG_TESTNAME "cppcheck" )
4141 endif ()
@@ -61,6 +61,10 @@ function(ament_cppcheck)
6161 if (ARG_INCLUDE_DIRS)
6262 list (APPEND cmd "--include_dirs" "${ARG_INCLUDE_DIRS} " )
6363 endif ()
64+ if (ARG_ENABLE_EXTRA_CHECKS)
65+ string (TOLOWER ${ARG_ENABLE_EXTRA_CHECKS} ARG_ENABLE_EXTRA_CHECKS)
66+ list (APPEND cmd "--enable-extra-checks" "${ARG_ENABLE_EXTRA_CHECKS} " )
67+ endif ()
6468
6569 file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR} /ament_cppcheck" )
6670 ament_add_test(
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ def main(argv=sys.argv[1:]):
9393 '--cppcheck-version' ,
9494 action = 'store_true' ,
9595 help = 'Get the cppcheck version, print it, and then exit.' )
96+ parser .add_argument (
97+ '--enable-extra-checks' ,
98+ help = "Passed to cppcheck as '--enable=<extra_checks>', and add extra checks to cppcheck "
99+ "as the given extra_checks (e.g. 'all', 'warning', 'style')." )
96100 args = parser .parse_args (argv )
97101
98102 cppcheck_bin = find_cppcheck_executable ()
@@ -161,6 +165,8 @@ def main(argv=sys.argv[1:]):
161165 cmd .extend (['--suppress=*:' + exclude ])
162166 if jobs :
163167 cmd .extend (['-j' , '%d' % jobs ])
168+ if args .enable_extra_checks :
169+ cmd .extend (['--enable={0}' .format (args .enable_extra_checks )])
164170 cmd .extend (files )
165171 try :
166172 p = subprocess .Popen (cmd , stderr = subprocess .PIPE )
You can’t perform that action at this time.
0 commit comments