Skip to content
Permalink
Browse files

Allow to specify glob pattern for ignored directories in servo-tidy.toml

  • Loading branch information
marmeladema committed Oct 22, 2019
1 parent 00cf745 commit 76ff22f5d0ac7b36230ac3d7e9599167b0f6349a
Showing with 5 additions and 3 deletions.
  1. +4 −2 python/tidy/servo_tidy/tidy.py
  2. +1 −1 servo-tidy.toml
@@ -10,6 +10,7 @@
from __future__ import print_function

import fnmatch
import glob
import imp
import itertools
import json
@@ -909,7 +910,7 @@ def check_config_file(config_file, print_text=True, no_wpt=False):
exclude = config_content.get("ignore", {})

# Check for invalid listed ignored directories
exclude_dirs = exclude.get("directories", [])
exclude_dirs = [d for p in exclude.get("directories", []) for d in (glob.glob(p) or [p])]
skip_dirs = ["./target", "./tests"]
invalid_dirs = [d for d in exclude_dirs if not os.path.isdir(d) and not any(s in d for s in skip_dirs)]

@@ -971,7 +972,8 @@ def check_config_file(config_file, print_text=True, no_wpt=False):
def parse_config(config_file):
exclude = config_file.get("ignore", {})
# Add list of ignored directories to config
config["ignore"]["directories"] += normilize_paths(exclude.get("directories", []))
ignored_directories = [d for p in exclude.get("directories", []) for d in (glob.glob(p) or [p])]
config["ignore"]["directories"] += normilize_paths(ignored_directories)
# Add list of ignored files to config
config["ignore"]["files"] += normilize_paths(exclude.get("files", []))
# Add list of ignored packages to config
@@ -91,7 +91,7 @@ directories = [
"./python/tidy/servo_tidy_tests",
"./components/script/dom/bindings/codegen/parser",
"./components/script/dom/bindings/codegen/ply",
"./python/_virtualenv",
"./python/_virtualenv*",
"./components/hashglobe/src",
# Generated and upstream code combined with our own. Could use cleanup
"./target",

0 comments on commit 76ff22f

Please sign in to comment.
You can’t perform that action at this time.