Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow to specify glob pattern for ignored directories in servo-tidy.toml
  • Loading branch information
marmeladema committed Dec 9, 2019
1 parent 00cf745 commit 76ff22f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions python/tidy/servo_tidy/tidy.py
Expand Up @@ -10,6 +10,7 @@
from __future__ import print_function

import fnmatch
import glob
import imp
import itertools
import json
Expand Down Expand Up @@ -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)]

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion servo-tidy.toml
Expand Up @@ -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",
Expand Down

0 comments on commit 76ff22f

Please sign in to comment.