diff --git a/.github/workflows/format_scan.yml b/.github/workflows/format_scan.yml index 377625b59..11de4f345 100644 --- a/.github/workflows/format_scan.yml +++ b/.github/workflows/format_scan.yml @@ -32,7 +32,7 @@ jobs: "bandit", "clangformat", "cloc", - "cpplint", + "clangtidy", # "pydocstyle", #"pyspelling", ] diff --git a/.github/workflows/scripts/formatScan/cpplint.sh b/.github/workflows/scripts/formatScan/clangtidy.sh similarity index 51% rename from .github/workflows/scripts/formatScan/cpplint.sh rename to .github/workflows/scripts/formatScan/clangtidy.sh index 7f341d3d1..740f12eac 100644 --- a/.github/workflows/scripts/formatScan/cpplint.sh +++ b/.github/workflows/scripts/formatScan/clangtidy.sh @@ -2,12 +2,19 @@ source /neural-speed/.github/workflows/scripts/change_color.sh -pip install cpplint +pip install cmake ninja clang-tidy REPO_DIR=/neural-speed log_dir=/neural-speed/.github/workflows/scripts/formatScan -log_path=${log_dir}/cpplint.log -cpplint --extensions cpp,hpp --filter=-build/include_subdir,-build/header_guard --recursive --quiet --linelength=120 ${REPO_DIR}/neural_speed 2>&1 | tee ${log_path} -if [[ ! -f ${log_path} ]] || [[ $(grep -c "Total errors found:" ${log_path}) != 0 ]]; then +log_path=${log_dir}/clangtidy.log + +# compile binary +cd ${REPO_DIR} +mkdir build +cd build +cmake .. -G Ninja -DNS_USE_CLANG_TIDY=CHECK +ninja 2>&1 | tee ${log_path} + +if [[ ! -f ${log_path} ]] || [[ $(grep -c "warning:" ${log_path}) != 0 ]]; then exit 1 fi $BOLD_PURPLE && echo "Congratulations, check passed!" && $LIGHT_PURPLE && echo "You can click on the artifact button to see the log details." && $RESET