pylint.cmake.in 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. @PYLINT_CONFIG_SCRIPT@
  2. set(__total 0)
  3. set(__passed 0)
  4. set(__errors 0)
  5. if(NOT DEFINED VERBOSE AND DEFINED ENV{VERBOSE})
  6. set(VERBOSE "$ENV{VERBOSE}")
  7. endif()
  8. foreach(__id ${PYLINT_TARGET_ID})
  9. message("Pylint check: ${PYLINT_TARGET_${__id}_TARGET}")
  10. set(__options ${PYLINT_TARGET_${__id}_OPTIONS})
  11. if(PYLINT_TARGET_${__id}_RCFILE)
  12. set(__options ${__options} --rcfile=${PYLINT_TARGET_${__id}_RCFILE})
  13. endif()
  14. set(__cwd "${PYLINT_TARGET_${__id}_CWD}")
  15. if(NOT __cwd)
  16. set(__cwd ".")
  17. endif()
  18. if(VERBOSE)
  19. message("Run: ${PYLINT_EXECUTABLE} \"${PYLINT_TARGET_${__id}_TARGET}\" ${__options}
  20. directory: \"${__cwd}\"")
  21. endif()
  22. execute_process(COMMAND ${PYLINT_EXECUTABLE} "${PYLINT_TARGET_${__id}_TARGET}" ${__options}
  23. WORKING_DIRECTORY "${__cwd}"
  24. RESULT_VARIABLE __res
  25. )
  26. math(EXPR __total "${__total} + 1")
  27. if(NOT __res EQUAL 0)
  28. math(EXPR __errors "${__errors} + 1")
  29. else()
  30. math(EXPR __passed "${__passed} + 1")
  31. endif()
  32. endforeach()
  33. message("Pylint status:
  34. TOTAL : ${__total}
  35. PASSED: ${__passed}
  36. ERRORS: ${__errors}
  37. ")
  38. if(NOT __errors EQUAL 0)
  39. message(SEND_ERROR "ERROR: Pylint check FAILED")
  40. endif()