Add BASH syntax check to linter#3369
Conversation
I got to be honest: I don't actually see any value in adding this check at the moment. To me In ./target/scripts/startup/setup.d/mail_state.sh line 37:
for SERVICEFILE in "${SERVICEFILES[@]}";; do
^-- SC1073 (error): Couldn't parse this for loop. Fix to allow more checks.
^-- SC1058 (error): Expected 'do'.is absolutely fine, and lo.sh: line 3: syntax error near unexpected token `;;'
lo.sh: line 3: `for SERVICEFILE in "${SERVICEFILES[@]}";; do'really adds no new information IMO. |
|
Another point is, the syntax check is pretty fast, less than a second on my setup. It runs before shellcheck and let the lint test fail much faster. |
|
Fair enough! And I mean, if it really helps others, I don't want to block it anyway :) |
georglauterbach
left a comment
There was a problem hiding this comment.
LGTM 👍🏼
#3370 is the last PR (together with this one) blocking v13.0.0 - please give it a quick review when you've got time @casperklein :)
Description
This PR adds an additional (syntax) check for our BASH scripts.
In my experience,
shellcheckdoes catch syntax errors, however the error message may be not as clear compared to a dedicated syntax check withbash -n.Type of change
Checklist:
docs/)