aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2016-08-04 18:12:54 -0400
committerAneesh Agrawal <aneeshusa@gmail.com>2016-08-05 09:29:10 -0400
commit9231ca1c6991c2eaf0d7e08674b2fc9c84a31695 (patch)
tree15c0c7cfbc998342d053e259d9138b6003a170bc /python/tidy/servo_tidy
parent79ef9b4efc307aa0aebfbeb5b0c120a3ad525399 (diff)
downloadservo-9231ca1c6991c2eaf0d7e08674b2fc9c84a31695.tar.gz
servo-9231ca1c6991c2eaf0d7e08674b2fc9c84a31695.zip
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).
Diffstat (limited to 'python/tidy/servo_tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index d47aa0137a0..50fd7ca8a5c 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -347,6 +347,13 @@ def check_shell(file_name, lines):
if "`" in stripped:
yield (idx + 1, "script should not use backticks for command substitution")
+ for dollar in re.finditer('\$', stripped):
+ next_idx = dollar.end()
+ if next_idx < len(stripped):
+ next_char = stripped[next_idx]
+ if not (next_char == '{' or next_char == '('):
+ yield(idx + 1, "variable substitutions should use the full \"${VAR}\" form")
+
def check_rust(file_name, lines):
if not file_name.endswith(".rs") or \