Repository navigation
Add alphabetical order check for use statements - #7265
Conversation
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @metajack (or someone else) soon. |
|
-S-awaiting-review +S-needs-code-changes Thank you for your PR. Unfortunately, this can't land until we have all these failures fixed. Is that something you'd like to work on? Reviewed 1 of 1 files at r1. python/tidy.py, line 179 [r1] (raw file): python/tidy.py, line 257 [r1] (raw file): python/tidy.py, line 258 [r1] (raw file): python/tidy.py, line 266 [r1] (raw file): Comments from the review on Reviewable.io |
|
Thanks for the review! |
|
Doing it here makes sense to me. |
|
Should be all good now ... I started doing all the fixes manually ... then used this script (my 2nd python script ever!): import os
from tempfile import mkstemp
from shutil import move
from os import remove, close
def replace_uses(file_path):
#Create temp file
fh, abs_path = mkstemp()
with open(abs_path,'w') as new_file:
with open(file_path) as old_file:
uses = []
for line in old_file:
if line.lstrip().startswith("use "):
uses.append(line[:len(line)-2])
else:
if len(uses) > 0:
new_file.write("".join([u + ";\n" for u in sorted(uses)]))
uses = []
new_file.write(line)
close(fh)
#Remove original file
remove(file_path)
#Move new file
move(abs_path, file_path)
# navigate the entire directories and replace uses
for root, subdirs, files in os.walk("./"):
for f in files:
if f.endswith(".rs"):
filePath = os.path.join(root, f)
replace_uses(filePath)@Ms2ger let me know if I must squash everything |
|
Maybe squash into two commits: first one that fixes all the |
|
Fine! I'll try to do it asap. |
d2b6603 to
cb2d3ef
Compare
|
Squashed and rebased (was failing the tests again). @Ms2ger let me know! |
|
Thanks! @bors-servo r+ p=1000 |
|
📌 Commit 009f6f6 has been approved by |
Add alphabetical order check for use statements close #7112 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7265) <!-- Reviewable:end -->
|
Thanks |
close #7112