Skip to content

Commit

Permalink
Merge pull request #12848 from jan-cerny/shellcheck_downgrade
Browse files Browse the repository at this point in the history
Change shellcheck tests
  • Loading branch information
Mab879 authored Jan 21, 2025
2 parents e4120cd + b7d2d12 commit fa1f32c
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions cmake/SSGCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,29 @@ macro(ssg_collect_remediations PRODUCT LANGUAGES)
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/collect-remediations-${PRODUCT}"
)
if(SSG_SHELLCHECK_BASH_FIXES_VALIDATION_ENABLED AND SHELLCHECK_EXECUTABLE)
add_test(
NAME "${PRODUCT}-bash-shellcheck"
COMMAND "${CMAKE_SOURCE_DIR}/utils/shellcheck_wrapper.sh" "${SHELLCHECK_EXECUTABLE}" "${CMAKE_BINARY_DIR}/${PRODUCT}/fixes/bash" -s bash -S warning
# Get the shellcheck version
execute_process(
COMMAND ${SHELLCHECK_EXECUTABLE} --version
OUTPUT_VARIABLE SHELLCHECK_VERSION_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set_tests_properties("${PRODUCT}-bash-shellcheck" PROPERTIES LABELS quick)

# Extract the version number from the output
string(REGEX MATCH "version: [0-9]+\\.[0-9]+\\.[0-9]+" SHELLCHECK_VERSION_LINE "${SHELLCHECK_VERSION_OUTPUT}")
string(REGEX REPLACE "version: " "" SHELLCHECK_VERSION "${SHELLCHECK_VERSION_LINE}")

if(SHELLCHECK_VERSION VERSION_GREATER_EQUAL "0.10.0")
add_test(
NAME "${PRODUCT}-bash-shellcheck"
COMMAND "${CMAKE_SOURCE_DIR}/utils/shellcheck_wrapper.sh" "${SHELLCHECK_EXECUTABLE}" "${CMAKE_BINARY_DIR}/${PRODUCT}/fixes/bash" -s bash -S warning "--extended-analysis=false"
)
else()
add_test(
NAME "${PRODUCT}-bash-shellcheck"
COMMAND "${CMAKE_SOURCE_DIR}/utils/shellcheck_wrapper.sh" "${SHELLCHECK_EXECUTABLE}" "${CMAKE_BINARY_DIR}/${PRODUCT}/fixes/bash" -s bash -S warning
)
endif()

endif()
endmacro()

Expand Down

0 comments on commit fa1f32c

Please sign in to comment.