mirror of
https://github.com/servo/servo.git
synced 2025-06-09 17:13:24 +00:00
Add lint for [
instead of [[
in shells scripts
This commit is contained in:
parent
9231ca1c69
commit
f07d8f188a
5 changed files with 17 additions and 8 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue