diff options
author | Saurabh Badhwar <sbsaurabhbadhwar9@gmail.com> | 2016-06-05 19:07:34 +0530 |
---|---|---|
committer | Saurabh Badhwar <sbsaurabhbadhwar9@gmail.com> | 2016-06-15 09:58:04 +0530 |
commit | 28312d0e17f0e19a5999a3faed6c03d43db72b06 (patch) | |
tree | c70afcd915bde5bb1afb3e42c9981dd6a705ba02 | |
parent | 573c0a74684dc0043da4800a84065d72453641fd (diff) | |
download | servo-28312d0e17f0e19a5999a3faed6c03d43db72b06.tar.gz servo-28312d0e17f0e19a5999a3faed6c03d43db72b06.zip |
Make mach consider ignored dirs
Address indentation changes
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 5 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/test_ignored/whee/test.rs | 0 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 10 |
3 files changed, 13 insertions, 2 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 5b66d2911e4..0c8a6211034 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -645,11 +645,12 @@ def get_file_list(directory, only_changed_files=False, exclude_dirs=[]): args = ["git", "ls-files", "--others", "--exclude-standard", directory] file_list += subprocess.check_output(args) for f in file_list.splitlines(): - yield os.path.join('.', f) + if os.path.join('.', os.path.dirname(f)) not in ignored_dirs: + yield os.path.join('.', f) elif exclude_dirs: for root, dirs, files in os.walk(directory, topdown=True): # modify 'dirs' in-place so that we don't do unwanted traversals in excluded directories - dirs[:] = [d for d in dirs if not any(os.path.join(root, d).startswith(name) for name in ignored_dirs)] + dirs[:] = [d for d in dirs if not any(os.path.join(root, d).startswith(name) for name in exclude_dirs)] for rel_path in files: yield os.path.join(root, rel_path) else: diff --git a/python/tidy/servo_tidy_tests/test_ignored/whee/test.rs b/python/tidy/servo_tidy_tests/test_ignored/whee/test.rs new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/python/tidy/servo_tidy_tests/test_ignored/whee/test.rs diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index c9291c1c2f2..170c447affa 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -113,6 +113,16 @@ class CheckTidiness(unittest.TestCase): self.assertEqual(msg, errors.next()[2]) self.assertNoMoreErrors(errors) + def test_file_list(self): + base_path='./python/tidy/servo_tidy_tests/test_ignored' + file_list = tidy.get_file_list(base_path, only_changed_files=False, + exclude_dirs=[]) + lst = list(file_list) + self.assertEqual([os.path.join(base_path, 'whee', 'test.rs')], lst) + file_list = tidy.get_file_list(base_path, only_changed_files=False, + exclude_dirs=[os.path.join(base_path,'whee')]) + lst = list(file_list) + self.assertEqual([], lst) def do_tests(): suite = unittest.TestLoader().loadTestsFromTestCase(CheckTidiness) |