Add lint to ensure substitutions use the full form

Check that any variable substitutions use the full ${VAR} form,
not just $VAR (but don't check for quoting yet).
This commit is contained in:
Aneesh Agrawal 2016-08-04 18:12:54 -04:00
parent 79ef9b4efc
commit 9231ca1c69
10 changed files with 23 additions and 14 deletions

View file

@ -7,3 +7,4 @@ set -o nounset
# Talking about some `concept in backticks` # shouldn't trigger
echo "hello world"
some_var=`echo "command substitution"`
another_var="$some_var"

View file

@ -53,6 +53,7 @@ class CheckTidiness(unittest.TestCase):
self.assertEqual('script does not have shebang "#!/usr/bin/env bash"', errors.next()[2])
self.assertEqual('script is missing options "set -o errexit", "set -o pipefail"', errors.next()[2])
self.assertEqual('script should not use backticks for command substitution', errors.next()[2])
self.assertEqual('variable substitutions should use the full \"${VAR}\" form', errors.next()[2])
self.assertNoMoreErrors(errors)
def test_rust(self):