Skip to content

Commit

Permalink
Add AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS flag (space-ros/space-ros#57
Browse files Browse the repository at this point in the history
…).

Signed-off-by: xfiderek <fiderekblazejgmail.com>
  • Loading branch information
xfiderek committed Mar 13, 2024
1 parent 622145e commit 3009e52
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ament_cmake_clang_format/cmake/ament_clang_format.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ function(ament_clang_format)
set(ARG_TESTNAME "clang_format")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_clang_format_BIN NAMES "ament_clang_format")
if(NOT ament_clang_format_BIN)
message(FATAL_ERROR "ament_clang_format() variable 'ament_clang_format_BIN' must not be empty")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_clang_tidy/cmake/ament_clang_tidy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ function(ament_clang_tidy)
set(ARG_TESTNAME "clang_tidy")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_clang_tidy_BIN NAMES "ament_clang_tidy")
if(NOT ament_clang_tidy_BIN)
message(FATAL_ERROR "ament_clang_tidy() variable 'ament_clang_tidy_BIN' must not be empty")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_copyright/cmake/ament_copyright.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ function(ament_copyright)
set(ARG_TIMEOUT 120)
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_copyright_BIN NAMES "ament_copyright")
if(NOT ament_copyright_BIN)
message(FATAL_ERROR "ament_copyright() could not find program 'ament_copyright'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_cppcheck/cmake/ament_cppcheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ function(ament_cppcheck)
set(ARG_TESTNAME "cppcheck")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_cppcheck_BIN NAMES "ament_cppcheck")
if(NOT ament_cppcheck_BIN)
message(FATAL_ERROR "ament_cppcheck() could not find program 'ament_cppcheck'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_cpplint/cmake/ament_cpplint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ function(ament_cpplint)
set(ARG_TESTNAME "cpplint")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_cpplint_BIN NAMES "ament_cpplint")
if(NOT ament_cpplint_BIN)
message(FATAL_ERROR "ament_cpplint() could not find program 'ament_cpplint'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_flake8/cmake/ament_flake8.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ function(ament_flake8)
set(ARG_TESTNAME "flake8")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_flake8_BIN NAMES "ament_flake8")
if(NOT ament_flake8_BIN)
message(FATAL_ERROR "ament_flake8() could not find program 'ament_flake8'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_lint_cmake/cmake/ament_lint_cmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ function(ament_lint_cmake)
set(ARG_TESTNAME "lint_cmake")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_lint_cmake_BIN NAMES "ament_lint_cmake")
if(NOT ament_lint_cmake_BIN)
message(FATAL_ERROR "ament_lint_cmake() could not find program 'ament_lint_cmake'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_mypy/cmake/ament_mypy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ function(ament_mypy)
set(ARG_TESTNAME "mypy")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_mypy_BIN NAMES "ament_mypy")
if(NOT ament_mypy_BIN)
message(FATAL_ERROR "ament_mypy() could not find program 'ament_mypy'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_pclint/cmake/ament_pclint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ function(ament_pclint)
set(ARG_TESTNAME "pclint")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_pclint_BIN NAMES "ament_pclint")
if(NOT ament_pclint_BIN)
message(FATAL_ERROR "ament_pclint() could not find program 'ament_pclint'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_pep257/cmake/ament_pep257.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ function(ament_pep257)
set(ARG_TESTNAME "pep257")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_pep257_BIN NAMES "ament_pep257")
if(NOT ament_pep257_BIN)
message(FATAL_ERROR "ament_pep257() could not find program 'ament_pep257'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_pycodestyle/cmake/ament_pycodestyle.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ function(ament_pycodestyle)
set(ARG_TESTNAME "pycodestyle")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_pycodestyle_BIN NAMES "ament_pycodestyle")
if(NOT ament_pycodestyle_BIN)
message(FATAL_ERROR "ament_pycodestyle() could not find program 'ament_pycodestyle'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_pyflakes/cmake/ament_pyflakes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ function(ament_pyflakes)
set(ARG_TESTNAME "pyflakes")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_pyflakes_BIN NAMES "ament_pyflakes")
if(NOT ament_pyflakes_BIN)
message(FATAL_ERROR "ament_pyflakes() could not find program 'ament_pyflakes'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_uncrustify/cmake/ament_uncrustify.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ function(ament_uncrustify)
set(ARG_TESTNAME "uncrustify")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_uncrustify_BIN NAMES "ament_uncrustify")
if(NOT ament_uncrustify_BIN)
message(FATAL_ERROR "ament_uncrustify() could not find program 'ament_uncrustify'")
Expand Down
9 changes: 9 additions & 0 deletions ament_cmake_xmllint/cmake/ament_xmllint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ function(ament_xmllint)
set(ARG_TESTNAME "xmllint")
endif()

# https://cmake.org/cmake/help/latest/prop_dir/TESTS.html
get_directory_property(_declared_tests TESTS)
if(DEFINED AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS)
if((AMENT_LINT_AUTO_SKIP_PREEXISTING_TESTS) AND (${ARG_TESTNAME} IN_LIST _declared_tests))
message(VERBOSE "skipping test '${ARG_TESTNAME}' as it has already been added")
return()
endif()
endif()

find_program(ament_xmllint_BIN NAMES "ament_xmllint")
if(NOT ament_xmllint_BIN)
message(FATAL_ERROR "ament_xmllint() could not find program 'ament_xmllint'")
Expand Down

0 comments on commit 3009e52

Please sign in to comment.