Skip to content

Commit 48ddc22

Browse files
ament_cmake_pep257: handle AMENT_LINT_AUTO_FILE_EXCLUDE
Fix part of #458 following guidelines from #423 Signed-off-by: Romain Reignier <[email protected]>
1 parent 5ad14bf commit 48ddc22

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

ament_cmake_pep257/cmake/ament_cmake_pep257_lint_hook.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,17 @@
1515
file(GLOB_RECURSE _python_files FOLLOW_SYMLINKS "*.py")
1616
if(_python_files)
1717
message(STATUS "Added test 'pep257' to check Python code against some of the docstring style conventions in PEP 257")
18-
ament_pep257()
18+
19+
# Get exclude paths for added targets
20+
set(_all_exclude "")
21+
if(DEFINED ament_cmake_pep257_ADDITIONAL_EXCLUDE)
22+
list(APPEND _all_exclude ${ament_cmake_pep257_ADDITIONAL_EXCLUDE})
23+
endif()
24+
25+
if(DEFINED AMENT_LINT_AUTO_FILE_EXCLUDE)
26+
list(APPEND _all_exclude ${AMENT_LINT_AUTO_FILE_EXCLUDE})
27+
endif()
28+
29+
message(STATUS "Configured pep257 exclude dirs and/or files: ${_all_exclude}")
30+
ament_pep257(EXCLUDE ${_all_exclude})
1931
endif()

ament_cmake_pep257/cmake/ament_pep257.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# @public
2424
#
2525
function(ament_pep257)
26-
cmake_parse_arguments(ARG "" "TESTNAME" "" ${ARGN})
26+
cmake_parse_arguments(ARG "" "EXCLUDE;TESTNAME" "" ${ARGN})
2727
if(NOT ARG_TESTNAME)
2828
set(ARG_TESTNAME "pep257")
2929
endif()
@@ -35,6 +35,9 @@ function(ament_pep257)
3535

3636
set(result_file "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${ARG_TESTNAME}.xunit.xml")
3737
set(cmd "${ament_pep257_BIN}" "--xunit-file" "${result_file}")
38+
if(ARG_EXCLUDE)
39+
list(APPEND cmd "--exclude" "${ARG_EXCLUDE}")
40+
endif()
3841
list(APPEND cmd ${ARG_UNPARSED_ARGUMENTS})
3942

4043
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/ament_pep257")

0 commit comments

Comments
 (0)