mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add 'use statements with extraneous spaces' tidy check
Add 'use statements with extraneous spaces' tidy check I added simple check routine for 'use statements with extraneous spaces' and codes that breaks the check routine in rust_tidy.rs. * Added a code that using 'use statements with extraneous spaces' code in rust_tidy.rs * Added assertion code in test_tidy.py. * check_rust function in tidy.py now recognizes the simple case in the 'use statements with extraneous spaces'. * Ran tidy check on rust code and modified a code(tests/unit/style/parsing/inherited_text.rs) that is not passing on this new tidy check. TODO: this code has to be refactored to support more general cases. - [X] ./mach test-tidy does not report any errors - [X] These changes fix #14898 (github issue number if applicable).
This commit is contained in:
parent
469ed934e7
commit
ccb14abd12
4 changed files with 8 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use azure::azure_hl::{ AntialiasMode, Color, ColorPattern, CompositionOp };
|
||||
use azure::azure_hl::{AntialiasMode, Color,
|
||||
ColorPattern, CompositionOp};
|
||||
use euclid::size::Size2D;
|
||||
|
|
|
@ -95,6 +95,8 @@ class CheckTidiness(unittest.TestCase):
|
|||
|
||||
def test_rust(self):
|
||||
errors = tidy.collect_errors_for_files(iterFile('rust_tidy.rs'), [], [tidy.check_rust], print_text=False)
|
||||
self.assertEqual('extra space after {', errors.next()[2])
|
||||
self.assertEqual('extra space before }', errors.next()[2])
|
||||
self.assertEqual('use statement spans multiple lines', errors.next()[2])
|
||||
self.assertEqual('missing space before }', errors.next()[2])
|
||||
self.assertTrue('use statement is not in alphabetical order' in errors.next()[2])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue