From 6efefa07ac2718b7feec1c0926f73cdcf96f11c8 Mon Sep 17 00:00:00 2001 From: Thibault Serti <43850264+thibaultserti@users.noreply.github.com> Date: Fri, 22 Jan 2021 14:45:01 +0100 Subject: [PATCH] Update shellcheck workflow fix #34 --- .github/workflows/shellcheck_and_shellfmt.yml | 11 +++++++++-- bin/hardening.sh | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/shellcheck_and_shellfmt.yml b/.github/workflows/shellcheck_and_shellfmt.yml index 26e3ff9..0e10e14 100644 --- a/.github/workflows/shellcheck_and_shellfmt.yml +++ b/.github/workflows/shellcheck_and_shellfmt.yml @@ -4,7 +4,7 @@ on: - push - pull_request jobs: - sh-checker: + shellfmt: runs-on: ubuntu-latest steps: - name: Checkout repo @@ -13,10 +13,17 @@ jobs: uses: luizm/action-sh-checker@v0.1.10 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Optional if sh_checker_comment is false. - SHELLCHECK_OPTS: --color=always --shell=bash -x --source-path=SCRIPTDIR # Optional: exclude some shellcheck warnings. SHFMT_OPTS: -l -i 4 -w # Optional: pass arguments to shfmt. with: + sh_checker_shellcheck_disable: true sh_checker_comment: true sh_checker_exclude: | src/ debian/postrm + shellcheck: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Run shellcheck + run: ./shellcheck/docker_build_and_run_shellcheck.sh diff --git a/bin/hardening.sh b/bin/hardening.sh index 70d53f5..7d64884 100755 --- a/bin/hardening.sh +++ b/bin/hardening.sh @@ -294,7 +294,7 @@ if [ "$BATCH_MODE" ]; then BATCH_SUMMARY+="RUN_CHECKS:${TOTAL_TREATED_CHECKS:-0} " BATCH_SUMMARY+="TOTAL_CHECKS_AVAIL:${TOTAL_CHECKS:-0}" if [ "$TOTAL_TREATED_CHECKS" != 0 ]; then - CONFORMITY_PERCENTAGE=$(div $(($PASSED_CHECKS * 100)) $TOTAL_TREATED_CHECKS) + CONFORMITY_PERCENTAGE=$(div $((PASSED_CHECKS * 100)) $TOTAL_TREATED_CHECKS) BATCH_SUMMARY+=" CONFORMITY_PERCENTAGE:$(printf "%s" "$CONFORMITY_PERCENTAGE")" else BATCH_SUMMARY+=" CONFORMITY_PERCENTAGE:N.A" # No check runned, avoid division by 0 @@ -307,8 +307,8 @@ else printf "%30s [ %7s ]\n" "Total Passed Checks :" "$PASSED_CHECKS/$TOTAL_TREATED_CHECKS" printf "%30s [ %7s ]\n" "Total Failed Checks :" "$FAILED_CHECKS/$TOTAL_TREATED_CHECKS" - ENABLED_CHECKS_PERCENTAGE=$(div $(($TOTAL_TREATED_CHECKS * 100)) $TOTAL_CHECKS) - CONFORMITY_PERCENTAGE=$(div $(($PASSED_CHECKS * 100)) $TOTAL_TREATED_CHECKS) + ENABLED_CHECKS_PERCENTAGE=$(div $((TOTAL_TREATED_CHECKS * 100)) $TOTAL_CHECKS) + CONFORMITY_PERCENTAGE=$(div $((PASSED_CHECKS * 100)) $TOTAL_TREATED_CHECKS) printf "%30s %s %%\n" "Enabled Checks Percentage :" "$ENABLED_CHECKS_PERCENTAGE" if [ "$TOTAL_TREATED_CHECKS" != 0 ]; then printf "%30s %s %%\n" "Conformity Percentage :" "$CONFORMITY_PERCENTAGE"