aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy_tests
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2016-08-04 15:16:04 -0400
committerAneesh Agrawal <aneeshusa@gmail.com>2016-08-05 09:29:09 -0400
commit79ef9b4efc307aa0aebfbeb5b0c120a3ad525399 (patch)
treeb551796547a19f22e2877c7a1ad7ad336c31d99b /python/tidy/servo_tidy_tests
parent4bc629b369242d16675161ab6af8141dab0bb556 (diff)
downloadservo-79ef9b4efc307aa0aebfbeb5b0c120a3ad525399.tar.gz
servo-79ef9b4efc307aa0aebfbeb5b0c120a3ad525399.zip
Add lint for backticks in shell scripts
The "$(some_command arg1 arg2)" form is preferred to the `some_command arg1 arg2` form because it nests unambiguously. Add a lint for this to tidy.
Diffstat (limited to 'python/tidy/servo_tidy_tests')
-rw-r--r--python/tidy/servo_tidy_tests/shell_tidy.sh2
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/shell_tidy.sh b/python/tidy/servo_tidy_tests/shell_tidy.sh
index fbf0e784755..ff8e5fc7240 100644
--- a/python/tidy/servo_tidy_tests/shell_tidy.sh
+++ b/python/tidy/servo_tidy_tests/shell_tidy.sh
@@ -4,4 +4,6 @@
set -o nounset
+# Talking about some `concept in backticks` # shouldn't trigger
echo "hello world"
+some_var=`echo "command substitution"`
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index b08e6057541..58e8f6e5fd3 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -52,6 +52,7 @@ class CheckTidiness(unittest.TestCase):
errors = tidy.collect_errors_for_files(iterFile('shell_tidy.sh'), [], [tidy.check_shell], print_text=False)
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.assertNoMoreErrors(errors)
def test_rust(self):