mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-23 14:41:00 -05:00
ef57e132e1
- Remove the previous summary file is present to avoid showing stale contents from old summaries. - Extract the logic to write summary heading and lines to dedicated functions in output.sh to make it easier adding new formats in the future.
40 lines
1 KiB
Bash
Executable file
40 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
WriteSummaryHeader() {
|
|
local SUPER_LINTER_SUMMARY_OUTPUT_PATH="${1}"
|
|
|
|
{
|
|
echo "# Super-linter summary"
|
|
echo ""
|
|
echo "| Language | Validation result |"
|
|
echo "| -----------------------|-------------------|"
|
|
} >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
|
}
|
|
|
|
WriteSummaryLineSuccess() {
|
|
local SUPER_LINTER_SUMMARY_OUTPUT_PATH="${1}"
|
|
local LANGUAGE_NAME="${2}"
|
|
echo "| ${LANGUAGE_NAME} | Pass ✅ |" >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
|
}
|
|
|
|
WriteSummaryLineFailure() {
|
|
local SUPER_LINTER_SUMMARY_OUTPUT_PATH="${1}"
|
|
local LANGUAGE_NAME="${2}"
|
|
echo "| ${LANGUAGE_NAME} | Fail ❌ |" >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
|
}
|
|
|
|
WriteSummaryFooterSuccess() {
|
|
local SUPER_LINTER_SUMMARY_OUTPUT_PATH="${1}"
|
|
{
|
|
echo ""
|
|
echo "All files and directories linted successfully"
|
|
} >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
|
}
|
|
|
|
WriteSummaryFooterFailure() {
|
|
local SUPER_LINTER_SUMMARY_OUTPUT_PATH="${1}"
|
|
{
|
|
echo ""
|
|
echo "Super-linter detected linting errors"
|
|
} >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
|
}
|