Skip to content

Commit 16eda38

Browse files
[PATCH] Applying updates as discussed in re-review (- WIP #184 -)
### ChangeLog: Changes in file .github/tool_checkmake.sh: export -f check_command readonly EMSG="Checkmake linter complained." Changes in file .github/workflows/bandit.yml: jobs: Changes in file .github/workflows/makefile-lint.yml: jobs: Changes in file .github/workflows/markdown-lint.yml: jobs: Changes in file .github/workflows/yaml-lint.yml: jobs: Changes in file tests/check_pip: check_command git ;
1 parent 8fe78ff commit 16eda38

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

.github/tool_checkmake.sh

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ check_command grep ;
8585
check_command cut ;
8686
check_command checkmake ;
8787

88+
# USAGE:
89+
# ~$ usage
90+
# Arguments:
91+
# None
92+
# Results:
93+
# Prints usage information and exits with status code 2.
8894
function usage() {
8995
printf "Usage: %s <makefile_path>\n" "${SCRIPT_NAME}" >&2
9096
exit 2
@@ -104,8 +110,24 @@ if [[ ! ( -f "${FILE}" ) ]]; then
104110
fi
105111

106112
# Main functionality
107-
{ { checkmake "${FILE}" | sed -e 's/ /:/g' | tr -s ':' |\
108-
cut -d: -f 3-5 ;} 2>/dev/null |\
109-
grep -F "${FILE}" | sed -E -e 's/^[[:space:]]+//g' |\
110-
xargs -I{} printf "::warning file=${FILE},title=LINT::%s ${EMSG}\n" {} >&2 ;}
111-
wait ;
113+
process_checkmake_output() {
114+
local file="$1"
115+
local emsg="$2"
116+
117+
if ! output=$(checkmake "${file}" 2>&1); then
118+
printf "%s\n" "::error::checkmake failed: ${output}" >&2
119+
return 1
120+
fi
121+
122+
printf "%s\n" "${output}" | \
123+
sed -e 's/ /:/g' | \
124+
tr -s ':' | \
125+
cut -d: -f 3-5 | \
126+
grep -F "${file}" | \
127+
sed -E -e 's/^[[:space:]]+//g' | \
128+
while IFS= read -r line; do
129+
printf "%s\n" "::warning file=${file},title=LINT::${line} ${emsg}" >&2
130+
done
131+
}
132+
133+
process_checkmake_output "${FILE}" "${EMSG}"

.github/workflows/bandit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout repository
32-
uses: actions/checkout@4
32+
uses: actions/checkout@v4
3333
with:
3434
persist-credentials: false
3535
- name: Bandit Scan

.github/workflows/makefile-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout repository
20-
uses: actions/checkout@4
20+
uses: actions/checkout@v4
2121
with:
2222
persist-credentials: false
2323
- name: Install Apt-Get Dependencies

.github/workflows/markdown-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout repository
21-
uses: actions/checkout@4
21+
uses: actions/checkout@v4
2222
with:
2323
persist-credentials: false
2424
- name: Install Apt-Get Dependencies

.github/workflows/yaml-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout repository
20-
uses: actions/checkout@4
20+
uses: actions/checkout@v4
2121
with:
2222
persist-credentials: false
2323
- name: Lint Workflow YAML

tests/check_pip

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,9 @@ check_command pip ;
133133
if command -v pip-audit >/dev/null 2>&1; then
134134
check_command pip-audit # optional
135135
else
136-
printf "%s\n" "::notice file=${SCRIPT_FILE},line=${BASH_LINENO:-0},title=SKIP::pip-audit not found, skipping security checks"
136+
printf "%s\n" "::notice file=${SCRIPT_FILE},line=${BASH_LINENO:-0},title=SKIP::pip-audit not found, skipping security checks" ;
137137
fi
138138
check_command pip-licenses ;
139-
check_command pip-licenses ;
140139
check_command shlock ;
141140

142141
# Set default exitcode to failure until sure we won't need to abort

0 commit comments

Comments
 (0)