mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Sort use
statements
This commit is contained in:
parent
45f7199eee
commit
76e59a46d3
162 changed files with 444 additions and 431 deletions
|
@ -256,10 +256,18 @@ def check_length(file_name, idx, line):
|
|||
|
||||
# Prefer shorter lines when shell scripting.
|
||||
max_length = 80 if file_name.endswith(".sh") else 120
|
||||
if len(line.rstrip('\n')) > max_length:
|
||||
if len(line.rstrip('\n')) > max_length and not is_unsplittable(file_name, line):
|
||||
yield (idx + 1, "Line is longer than %d characters" % max_length)
|
||||
|
||||
|
||||
def is_unsplittable(file_name, line):
|
||||
return (
|
||||
file_name.endswith(".rs") and
|
||||
line.startswith("use ") and
|
||||
"{" not in line
|
||||
)
|
||||
|
||||
|
||||
def check_whatwg_specific_url(idx, line):
|
||||
match = re.search(r"https://html\.spec\.whatwg\.org/multipage/[\w-]+\.html#([\w\:-]+)", line)
|
||||
if match is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue