Skip to content

Commit

Permalink
Merge "fix(tools): allow Cmake 3.16 to run static checks" into integr…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
soby-mathew authored and TrustedFirmware Code Review committed Dec 8, 2022
2 parents 0f4441d + af203f0 commit 35f487b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
11 changes: 8 additions & 3 deletions tools/checkincludes/CheckIncludes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ function(run_checkincludes source_files errors_ret)
COMMAND ${CHECKINCLUDES_EXECUTABLE} ${source_files}
OUTPUT_VARIABLE checkincludes_output
RESULT_VARIABLE checkincludes_rc
ECHO_OUTPUT_VARIABLE
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(checkincludes_output)
message(${checkincludes_output})
endif()

# checkincludes failed for this file. Collect no.of errors
if(${checkincludes_rc} GREATER 0)
checkincludes_get_stats("${checkincludes_output}" errors)
Expand Down Expand Up @@ -145,8 +148,10 @@ if(CHECKINCLUDES_PATCH)
set(source_files "")
filter_source_files("${files_in_commit}" source_files)

run_checkincludes("${source_files}" errors)
MATH(EXPR total_errors "${total_errors}+${errors}")
if(source_files)
run_checkincludes("${source_files}" errors)
MATH(EXPR total_errors "${total_errors}+${errors}")
endif()
endforeach()

print_stats_and_exit("checkincludes-patch" ${total_errors})
Expand Down
5 changes: 4 additions & 1 deletion tools/checkpatch/CheckPatch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,12 @@ if(CHECKPATCH_RUN)
COMMAND ${CHECKPATCH_EXECUTABLE} -
OUTPUT_VARIABLE checkpatch_output
RESULT_VARIABLE checkpatch_rc
ECHO_OUTPUT_VARIABLE
)

if(checkpatch_output)
message(${checkpatch_output})
endif()

# checkpatch.pl failed for this commit. Collect no.of errors and warnings
if(${checkpatch_rc})
checkpatch_get_stats("${checkpatch_output}" errors warnings)
Expand Down
12 changes: 9 additions & 3 deletions tools/checkspdx/CheckSPDX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ function(run_checkspdx source_files errors_ret)
COMMAND ${CHECKSPDX_EXECUTABLE} -r docs/readme.rst ${source_files}
OUTPUT_VARIABLE checkspdx_output
RESULT_VARIABLE checkspdx_rc
ECHO_OUTPUT_VARIABLE
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(checkspdx_output)
message(${checkspdx_output})
endif()

# checkspdx failed for this file. Collect no.of errors
if(${checkspdx_rc} GREATER 0)
checkspdx_get_stats("${checkspdx_output}" errors)
Expand Down Expand Up @@ -141,8 +144,11 @@ if(CHECKSPDX_PATCH)
list(FILTER source_files EXCLUDE REGEX "${exclude}")
endforeach()

run_checkspdx("${source_files}" errors)
MATH(EXPR total_errors "${total_errors}+${errors}")
# run check if the list is not empty
if(source_files)
run_checkspdx("${source_files}" errors)
MATH(EXPR total_errors "${total_errors}+${errors}")
endif()
endforeach()

print_stats_and_exit("checkspdx-patch" ${total_errors})
Expand Down

0 comments on commit 35f487b

Please sign in to comment.