From f07d8f188a0621545957a0f348271d29b08704ec Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Fri, 5 Aug 2016 09:42:04 -0400 Subject: Add lint for `[` instead of `[[` in shells scripts --- python/tidy/servo_tidy/tidy.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'python/tidy/servo_tidy/tidy.py') diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 50fd7ca8a5c..3433e8265ed 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -347,6 +347,9 @@ def check_shell(file_name, lines): if "`" in stripped: yield (idx + 1, "script should not use backticks for command substitution") + if " [ " in stripped or stripped.startswith("[ "): + yield (idx + 1, "script should use `[[` instead of `[` for conditional testing") + for dollar in re.finditer('\$', stripped): next_idx = dollar.end() if next_idx < len(stripped): -- cgit v1.2.3