mirror of
https://github.com/opencv/opencv.git
synced 2026-07-28 23:03:03 +04:00
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
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# 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()
|
||||
Reference in New Issue
Block a user