зеркало из https://github.com/microsoft/LightGBM.git
[ci] Run cmakelint at CI and fix some errors (#4617)
This commit is contained in:
Родитель
b5557b6b98
Коммит
c3b60c289b
|
@ -71,7 +71,7 @@ if [[ $TASK == "lint" ]]; then
|
|||
libxml2 \
|
||||
"r-xfun>=0.19" \
|
||||
"r-lintr>=2.0"
|
||||
pip install --user cpplint isort mypy
|
||||
pip install --user cmakelint cpplint isort mypy
|
||||
echo "Linting Python code"
|
||||
pycodestyle --ignore=E501,W503 --exclude=./.nuget,./external_libs . || exit -1
|
||||
pydocstyle --convention=numpy --add-ignore=D105 --match-dir="^(?!^external_libs|test|example).*" --match="(?!^test_|setup).*\.py" . || exit -1
|
||||
|
@ -81,6 +81,8 @@ if [[ $TASK == "lint" ]]; then
|
|||
Rscript ${BUILD_DIRECTORY}/.ci/lint_r_code.R ${BUILD_DIRECTORY} || exit -1
|
||||
echo "Linting C++ code"
|
||||
cpplint --filter=-build/c++11,-build/include_subdir,-build/header_guard,-whitespace/line_length --recursive ./src ./include ./R-package ./swig ./tests || exit -1
|
||||
cmake_files=$(find . -name CMakeLists.txt -o -path "*/cmake/*.cmake")
|
||||
cmakelint --linelength=120 ${cmake_files} || true
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ PROJECT(lightgbm LANGUAGES C CXX)
|
|||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
|
||||
|
||||
#-- Sanitizer
|
||||
if (USE_SANITIZER)
|
||||
if(USE_SANITIZER)
|
||||
if(MSVC)
|
||||
message(FATAL_ERROR "Sanitizers are not supported with MSVC.")
|
||||
endif(MSVC)
|
||||
|
@ -144,11 +144,11 @@ if(USE_GPU)
|
|||
find_package(OpenCL REQUIRED)
|
||||
include_directories(${OpenCL_INCLUDE_DIRS})
|
||||
MESSAGE(STATUS "OpenCL include directory: " ${OpenCL_INCLUDE_DIRS})
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
find_package(Boost 1.56.0 COMPONENTS filesystem system REQUIRED)
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
# disable autolinking in boost
|
||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||
endif()
|
||||
|
@ -194,7 +194,7 @@ if(USE_CUDA)
|
|||
message(STATUS "CMAKE_CUDA_FLAGS: ${CMAKE_CUDA_FLAGS}")
|
||||
|
||||
ADD_DEFINITIONS(-DUSE_CUDA)
|
||||
if (NOT DEFINED CMAKE_CUDA_STANDARD)
|
||||
if(NOT DEFINED CMAKE_CUDA_STANDARD)
|
||||
set(CMAKE_CUDA_STANDARD 11)
|
||||
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
@ -230,7 +230,7 @@ if(USE_CUDA)
|
|||
)
|
||||
endfunction()
|
||||
|
||||
foreach (hsize _16_64_256)
|
||||
foreach(hsize _16_64_256)
|
||||
add_histogram("${hsize}" "_sp_const" "True" "1" "${BASE_DEFINES}")
|
||||
add_histogram("${hsize}" "_sp" "True" "0" "${BASE_DEFINES}")
|
||||
add_histogram("${hsize}" "-allfeats_sp_const" "False" "1" "${ALLFEATS_DEFINES}")
|
||||
|
@ -364,7 +364,7 @@ if(__BUILD_FOR_R)
|
|||
list(APPEND SOURCES "src/lightgbm_R.cpp")
|
||||
endif(__BUILD_FOR_R)
|
||||
|
||||
if (BUILD_STATIC_LIB)
|
||||
if(BUILD_STATIC_LIB)
|
||||
add_library(_lightgbm STATIC ${SOURCES})
|
||||
else()
|
||||
add_library(_lightgbm SHARED ${SOURCES})
|
||||
|
|
|
@ -79,7 +79,7 @@ elseif(WIN32)
|
|||
endif()
|
||||
|
||||
|
||||
if (NOT LIBR_EXECUTABLE)
|
||||
if(NOT LIBR_EXECUTABLE)
|
||||
find_program(
|
||||
LIBR_EXECUTABLE
|
||||
NAMES R R.exe
|
||||
|
@ -99,7 +99,7 @@ if (NOT LIBR_EXECUTABLE)
|
|||
endif()
|
||||
|
||||
# Find R executable unless it has been provided directly or already found
|
||||
if (NOT LIBR_EXECUTABLE)
|
||||
if(NOT LIBR_EXECUTABLE)
|
||||
if(APPLE)
|
||||
|
||||
find_library(LIBR_LIBRARIES R)
|
||||
|
@ -193,7 +193,7 @@ find_library(
|
|||
|
||||
# starting from CMake 3.17, find_library() will not find .dll files by default
|
||||
# https://cmake.org/cmake/help/v3.17/release/3.17.html#other-changes
|
||||
if (WIN32 AND NOT LIBR_CORE_LIBRARY)
|
||||
if(WIN32 AND NOT LIBR_CORE_LIBRARY)
|
||||
find_file(
|
||||
LIBR_CORE_LIBRARY
|
||||
NAME R.dll
|
||||
|
|
Загрузка…
Ссылка в новой задаче