servo: Merge #12877 - Tidy config file (from UK992:tidy-toml); r=Wafflespeanut
This is wip workaround for https://github.com/servo/servo/issues/10841 Adds ``servo-tidy.toml`` with configs and ignored dirs, files and packages. This will allow to set custom configuration per repo. It's an example how could config file looks like. I want opinion on that, if this is right approaches and how to improve it. cc @edunham Source-Repo: https://github.com/servo/servo Source-Revision: 1c9650cc90090784c63f5af55628ffe6b57c25ed
This commit is contained in:
13
servo/python/tidy/servo_tidy_tests/servo-tidy.toml
Normal file
13
servo/python/tidy/servo_tidy_tests/servo-tidy.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
key-outside = ""
|
||||
|
||||
[configs]
|
||||
skip-check-length = false
|
||||
skip-check-licenses = false
|
||||
wrong-key = false
|
||||
|
||||
[wrong]
|
||||
wrong-key = true
|
||||
|
||||
[ignore]
|
||||
files = []
|
||||
directories = []
|
||||
@@ -23,6 +23,13 @@ class CheckTidiness(unittest.TestCase):
|
||||
with self.assertRaises(StopIteration):
|
||||
errors.next()
|
||||
|
||||
def test_tidy_config(self):
|
||||
errors = tidy.check_config_file(os.path.join(base_path, 'servo-tidy.toml'))
|
||||
self.assertEqual('invalid config key \'key-outside\'', errors.next()[2])
|
||||
self.assertEqual('invalid config key \'wrong-key\'', errors.next()[2])
|
||||
self.assertEqual('invalid config table [wrong]', errors.next()[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_spaces_correctnes(self):
|
||||
errors = tidy.collect_errors_for_files(iterFile('wrong_space.rs'), [], [tidy.check_by_line], print_text=False)
|
||||
self.assertEqual('trailing whitespace', errors.next()[2])
|
||||
|
||||
Reference in New Issue
Block a user