tidy: Improve check_shell substitution lint (#42099)

Probably we should use a proper linter like `shellcheck`, but in the
meantime make the lint slightly smarter, so that it doesn't complaint
about e.g. `$1`. This is especially a problem when adding scripts which
use `awk`, since our lint is quite stupid and doesn't understand `''`
strings.
This fixes linting, for a simple new script introduced in
https://github.com/servo/servo/pull/41775

Testing: ./mach test-tidy still passes.

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender
2026-01-23 16:10:15 +01:00
committed by GitHub
parent cdf8dad62c
commit 9a4192a5e3
2 changed files with 15 additions and 2 deletions

View File

@@ -12,3 +12,9 @@ if [ -z "${some_var}" ]; then
echo "should have used [["
fi
[ -z "${another_var}" ]
# Using $@, $1 etc. shouldn't trigger.
echo "$@"
if [[ -n "$1" ]]; then
echo "parameter 1 is $1"
fi
echo "item1 item2 item3" | awk '{$1=$1;print}'