mirror of
https://github.com/servo/servo.git
synced 2025-06-08 08:33:26 +00:00
Handle escaped strings in rust linting, tidy.py
tidy.py now strips strings even if they have escapes before linting. Use raw strings for regex with lots of backslashes Handle ALL escape sequences in strings for tidy, not just escaped string terminators
This commit is contained in:
parent
743e0c9c87
commit
9b91c7afeb
1 changed files with 2 additions and 1 deletions
|
@ -290,7 +290,7 @@ def check_rust(file_name, lines):
|
|||
|
||||
# get rid of strings and chars because cases like regex expression, keep attributes
|
||||
if not line_is_attribute(line):
|
||||
line = re.sub('".*?"|\'.*?\'', '', line)
|
||||
line = re.sub(r'"(\\.|[^\\"])*?"|' + r"'(\\.|[^\\'])*?'", '', line)
|
||||
|
||||
# get rid of comments
|
||||
line = re.sub('//.*?$|/\*.*?$|^\*.*?$', '', line)
|
||||
|
@ -346,6 +346,7 @@ def check_rust(file_name, lines):
|
|||
for match in re.finditer(pattern, line):
|
||||
if not filter_func(match, line):
|
||||
continue
|
||||
|
||||
yield (idx + 1, message.format(*match.groups(), **match.groupdict()))
|
||||
|
||||
# check alphabetical order of extern crates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue