diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-22 10:40:06 -0700 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-22 10:40:06 -0700 |
commit | d926b5d3762a101d5280266f806f2b979f73b695 (patch) | |
tree | 07ca09b75004f11a8a7458251ac7fa1ad2fb0c10 /python/tidy | |
parent | 4da6855e2332ce433fd6d6ea9d84cbb940df2b41 (diff) | |
parent | 39780ca39f2beff6c0f8e55eab75022b27cd046e (diff) | |
download | servo-d926b5d3762a101d5280266f806f2b979f73b695.tar.gz servo-d926b5d3762a101d5280266f806f2b979f73b695.zip |
Auto merge of #10751 - zwn:tidy-start-operator, r=Wafflespeanut
Report lines starting with && in tidy
Partial implementation of the issue #10692 (the easy part).
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10751)
<!-- Reviewable:end -->
Diffstat (limited to 'python/tidy')
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 4 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/rust_tidy.rs | 5 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 0baa11dfe90..aca74956c6f 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -378,6 +378,7 @@ def check_rust(file_name, lines): (r": &Vec<", "use &[T] instead of &Vec<T>", no_filter), # No benefit over using &str (r": &String", "use &str instead of &String", no_filter), + (r"^&&", "operators should go at the end of the first line", no_filter), ] for pattern, message, filter_func in regex_rules: @@ -647,6 +648,7 @@ def scan(faster=False, progress=True): error = None for error in errors: print "\r\033[94m{}\033[0m:\033[93m{}\033[0m: \033[91m{}\033[0m".format(*error) + print if error is None: - print "\n\033[92mtidy reported no errors.\033[0m" + print "\033[92mtidy reported no errors.\033[0m" return int(error is not None) diff --git a/python/tidy/servo_tidy_tests/rust_tidy.rs b/python/tidy/servo_tidy_tests/rust_tidy.rs index 680b527f679..580f9e2ea96 100644 --- a/python/tidy/servo_tidy_tests/rust_tidy.rs +++ b/python/tidy/servo_tidy_tests/rust_tidy.rs @@ -32,6 +32,9 @@ impl test { } fn test_fun2(y : &String, z : &Vec<f32>) -> f32 { - 1 + let x = true; + x + && x; } + } diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 69bb4ae4e46..f61c7961195 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -70,6 +70,7 @@ class CheckTidiness(unittest.TestCase): self.assertEqual('extra space before :', errors.next()[2]) self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2]) self.assertEqual('use &str instead of &String', errors.next()[2]) + self.assertEqual('operators should go at the end of the first line', errors.next()[2]) self.assertNoMoreErrors(errors) def test_spec_link(self): |