forked from Mirror/pmbootstrap
ci/markdown: fix shellcheck errors (MR 2485)
Don't try to modify a variable in the while loop, as it runs in a subshell because of the pipe. Fail on the first error instead, like we have it in .ci/shellcheck.sh. This can be optimized later on (for both scripts) if we really want to. Fix for: In ./.ci/markdown.sh line 17: markdownlint-cli "$file" || MDL_FAILED=1 ^--------^ SC2030 (info): Modification of MDL_FAILED is local (to subshell caused by pipeline). In ./.ci/markdown.sh line 20: if [ "$MDL_FAILED" = "1" ]; then ^---------^ SC2031 (info): MDL_FAILED was modified in a subshell. That change might be lost.
This commit is contained in:
parent
22d777bd82
commit
3b5e66d289
1 changed files with 5 additions and 7 deletions
|
@ -22,14 +22,12 @@ if ! command -v "$MDL" >/dev/null; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
MDL_FAILED=0
|
||||
find . -name '*.md' |
|
||||
while read -r file; do
|
||||
echo "mdl: $file"
|
||||
"$MDL" "$file" || MDL_FAILED=1
|
||||
if ! "$MDL" "$file"; then
|
||||
echo
|
||||
echo "markdown lint failed!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$MDL_FAILED" = "1" ]; then
|
||||
echo "markdown lint failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue