aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy/tidy.py
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-11-01 17:23:56 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-11-06 15:26:02 +0100
commit76e59a46d3aff701b2e8dfbaf047f6d5c3edcced (patch)
treeee36ca9b3f981d01184871fe72fbc31347086e92 /python/tidy/servo_tidy/tidy.py
parent45f7199eee82c66637ec68287eafa40a651001c4 (diff)
downloadservo-76e59a46d3aff701b2e8dfbaf047f6d5c3edcced.tar.gz
servo-76e59a46d3aff701b2e8dfbaf047f6d5c3edcced.zip
Sort `use` statements
Diffstat (limited to 'python/tidy/servo_tidy/tidy.py')
-rw-r--r--python/tidy/servo_tidy/tidy.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 192e784efd6..9059c1f9843 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -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: