mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
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:
parent
79ef9b4efc
commit
9231ca1c69
10 changed files with 23 additions and 14 deletions
|
@ -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 \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue