mirror of
https://github.com/servo/servo
synced 2026-04-26 09:35:26 +02:00
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>
21 lines
444 B
Bash
21 lines
444 B
Bash
#!/bin/bash
|
|
#
|
|
# Tests tidy for shell scripts.
|
|
|
|
set -o nounset
|
|
|
|
# Talking about some `concept in backticks` # shouldn't trigger
|
|
echo "hello world"
|
|
some_var=`echo "command substitution"`
|
|
another_var="$some_var"
|
|
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}'
|