[CI] add cmakelint to C++ linting task (#9641)

Co-authored-by: Jiaming Yuan <jm.yuan@outlook.com>
This commit is contained in:
James Lamb 2023-10-11 03:04:10 -05:00 committed by GitHub
parent 0ecb4de963
commit 51e32e4905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -141,7 +141,7 @@ jobs:
architecture: 'x64'
- name: Install Python packages
run: |
python -m pip install wheel setuptools cpplint pylint
python -m pip install wheel setuptools cmakelint cpplint pylint
- name: Run lint
run: |
python3 tests/ci_build/lint_cpp.py xgboost cpp R-package/src
@ -150,3 +150,5 @@ jobs:
--exclude_path python-package/xgboost/dmlc-core python-package/xgboost/include \
python-package/xgboost/lib python-package/xgboost/rabit \
python-package/xgboost/src
sh ./tests/ci_build/lint_cmake.sh || true

View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
cmake_files=$(
find . -name CMakeLists.txt -o -path "./cmake/*.cmake" \
| grep -v dmlc-core \
| grep -v gputreeshap
)
cmakelint \
--linelength=120 \
--filter=-convention/filename,-package/stdargs,-readability/wonkycase \
${cmake_files} \
|| exit 1