aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2016-08-05 09:42:04 -0400
committerAneesh Agrawal <aneeshusa@gmail.com>2016-08-05 09:42:04 -0400
commitf07d8f188a0621545957a0f348271d29b08704ec (patch)
tree588cf61bdc7b92ba628d5341d9e28bb40be46e7d /python/tidy/servo_tidy
parent9231ca1c6991c2eaf0d7e08674b2fc9c84a31695 (diff)
downloadservo-f07d8f188a0621545957a0f348271d29b08704ec.tar.gz
servo-f07d8f188a0621545957a0f348271d29b08704ec.zip
Add lint for `[` instead of `[[` in shells scripts
Diffstat (limited to 'python/tidy/servo_tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py3
1 files changed, 3 insertions, 0 deletions
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):