From 616eb83bbabe44d4a7034bcd377d6ee42806c171 Mon Sep 17 00:00:00 2001 From: Matt Schmoyer Date: Sat, 1 Oct 2016 11:36:58 -0400 Subject: [PATCH 1/2] Avoid unecessary loop evaluation on empty lines for tidy check_license --- python/tidy/servo_tidy/tidy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 30327559e3a..410c0af7ac3 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -149,8 +149,9 @@ def check_license(file_name, lines): l = l.rstrip('\n') if not l.strip(): blank_lines += 1 - if blank_lines >= max_blank_lines: - break + if blank_lines >= max_blank_lines: + break + continue line = uncomment(l) if line is not None: license_block.append(line) From 4846be1fdb9c3127a2dedc474c370efcf7439b0e Mon Sep 17 00:00:00 2001 From: Matt Schmoyer Date: Sat, 1 Oct 2016 12:25:57 -0400 Subject: [PATCH 2/2] using word license in test name for consistency --- python/tidy/servo_tidy_tests/test_tidy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 52371b944bb..4bf21cfa5e4 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -55,7 +55,7 @@ class CheckTidiness(unittest.TestCase): self.assertTrue('links to WHATWG single-page url, change to multi page:' in errors.next()[2]) self.assertNoMoreErrors(errors) - def test_licence(self): + def test_license(self): errors = tidy.collect_errors_for_files(iterFile('incorrect_license.rs'), [], [tidy.check_license], print_text=False) self.assertEqual('incorrect license', errors.next()[2]) self.assertNoMoreErrors(errors)