opencv/samples/python/tutorial_code/CMakeLists.txt
tribta b7fa6d84bc Using Pylint Tool to Test the python tutorial codes
* Adding CMake script to check if pylint is installed
* Adding Pylint config file (to choose the tests that are enabled)
* Adding CMake script to samples/python/tutorial_code

Testing: bad-indentation, mixed-indentation, unnecessary-semicolon, unused-variable
2017-08-24 14:58:48 +03:00

24 lines
889 B
CMake

# ----------------------------------------------------------------------------
# CMake file to run pylint on the tutorial python files.
#
# ----------------------------------------------------------------------------
include(${CMAKE_SOURCE_DIR}/cmake/FindPylint.cmake)
project(run_pylint_on_tutorials)
if(PYLINT_FOUND)
message(STATUS "pylint version: ${PYLINT_VERSION}")
set(curdir "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB_RECURSE PYTHON_SCRIPTS ${curdir}/*.py)
add_custom_target("${PROJECT_NAME}")
foreach(SCRIPT ${PYTHON_SCRIPTS})
get_filename_component(SCRIPT_NAME ${SCRIPT} NAME_WE)
add_custom_command(TARGET "${PROJECT_NAME}"
COMMAND ${PYLINT_EXECUTABLE} ${SCRIPT}
--rcfile=${curdir}/pylintrc
COMMENT "Running pylint on : ${SCRIPT_NAME}.py"
)
endforeach()
endif()