mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #15023 - mdevlamynck:tidy-config, r=Wafflespeanut
Moved tidy's BLOCKED_PACKAGES to the config file <!-- Please describe your changes on the following line: --> Moved tidy.py's BLOCKED_PACKAGES to servo-tidy.toml. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15014 (github issue number if applicable). <!-- Either: --> - [X] These changes do not require tests because this is a refactor and the existing tests have been adapted. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15023) <!-- Reviewable:end -->
This commit is contained in:
commit
7eb811b837
3 changed files with 28 additions and 23 deletions
|
@ -31,6 +31,7 @@ config = {
|
||||||
"skip-check-licenses": False,
|
"skip-check-licenses": False,
|
||||||
"check-ordered-json-keys": [],
|
"check-ordered-json-keys": [],
|
||||||
"lint-scripts": [],
|
"lint-scripts": [],
|
||||||
|
"blocked-packages": {},
|
||||||
"ignore": {
|
"ignore": {
|
||||||
"files": [
|
"files": [
|
||||||
os.path.join(".", "."), # ignore hidden files
|
os.path.join(".", "."), # ignore hidden files
|
||||||
|
@ -81,27 +82,6 @@ WEBIDL_STANDARDS = [
|
||||||
" accessible to\n// web pages."
|
" accessible to\n// web pages."
|
||||||
]
|
]
|
||||||
|
|
||||||
# Packages which we avoid using in Servo.
|
|
||||||
# For each blocked package, we can list the exceptions,
|
|
||||||
# which are packages allowed to use the blocked package.
|
|
||||||
BLOCKED_PACKAGES = {
|
|
||||||
"rand": [
|
|
||||||
"deque",
|
|
||||||
"gaol",
|
|
||||||
"ipc-channel",
|
|
||||||
"num-bigint",
|
|
||||||
"parking_lot_core",
|
|
||||||
"phf_generator",
|
|
||||||
"rayon",
|
|
||||||
"servo_rand",
|
|
||||||
"tempdir",
|
|
||||||
"tempfile",
|
|
||||||
"uuid",
|
|
||||||
"websocket",
|
|
||||||
"ws",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def is_iter_empty(iterator):
|
def is_iter_empty(iterator):
|
||||||
try:
|
try:
|
||||||
|
@ -366,7 +346,7 @@ def check_lock(file_name, contents):
|
||||||
for dependency in package.get("dependencies", []):
|
for dependency in package.get("dependencies", []):
|
||||||
dependency = dependency.split()
|
dependency = dependency.split()
|
||||||
dependency_name = dependency[0]
|
dependency_name = dependency[0]
|
||||||
whitelist = BLOCKED_PACKAGES.get(dependency_name)
|
whitelist = config['blocked-packages'].get(dependency_name)
|
||||||
if whitelist is not None:
|
if whitelist is not None:
|
||||||
if package_name not in whitelist:
|
if package_name not in whitelist:
|
||||||
fmt = "Package {} {} depends on blocked package {}."
|
fmt = "Package {} {} depends on blocked package {}."
|
||||||
|
@ -856,7 +836,7 @@ def check_config_file(config_file, print_text=True):
|
||||||
# Check for invalid tables
|
# Check for invalid tables
|
||||||
if re.match("\[(.*?)\]", line.strip()):
|
if re.match("\[(.*?)\]", line.strip()):
|
||||||
table_name = re.findall(r"\[(.*?)\]", line)[0].strip()
|
table_name = re.findall(r"\[(.*?)\]", line)[0].strip()
|
||||||
if table_name not in ("configs", "ignore", "check_ext"):
|
if table_name not in ("configs", "blocked-packages", "ignore", "check_ext"):
|
||||||
yield config_file, idx + 1, "invalid config table [%s]" % table_name
|
yield config_file, idx + 1, "invalid config table [%s]" % table_name
|
||||||
current_table = table_name
|
current_table = table_name
|
||||||
continue
|
continue
|
||||||
|
@ -894,6 +874,9 @@ def parse_config(content):
|
||||||
for path, exts in dirs_to_check.items():
|
for path, exts in dirs_to_check.items():
|
||||||
config['check_ext'][normilize_paths([path])[0]] = exts
|
config['check_ext'][normilize_paths([path])[0]] = exts
|
||||||
|
|
||||||
|
# Add list of blocked packages
|
||||||
|
config["blocked-packages"] = config_file.get("blocked-packages", {})
|
||||||
|
|
||||||
# Override default configs
|
# Override default configs
|
||||||
user_configs = config_file.get("configs", [])
|
user_configs = config_file.get("configs", [])
|
||||||
for pref in user_configs:
|
for pref in user_configs:
|
||||||
|
|
|
@ -5,6 +5,8 @@ skip-check-length = false
|
||||||
skip-check-licenses = false
|
skip-check-licenses = false
|
||||||
wrong-key = false
|
wrong-key = false
|
||||||
|
|
||||||
|
[blocked-packages]
|
||||||
|
|
||||||
[wrong]
|
[wrong]
|
||||||
wrong-key = true
|
wrong-key = true
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,26 @@ lint-scripts = [
|
||||||
"./python/servo/lints/wpt_lint.py",
|
"./python/servo/lints/wpt_lint.py",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Packages which we avoid using in Servo.
|
||||||
|
# For each blocked package, we can list the exceptions,
|
||||||
|
# which are packages allowed to use the blocked package.
|
||||||
|
[blocked-packages]
|
||||||
|
rand = [
|
||||||
|
"deque",
|
||||||
|
"gaol",
|
||||||
|
"ipc-channel",
|
||||||
|
"num-bigint",
|
||||||
|
"parking_lot_core",
|
||||||
|
"phf_generator",
|
||||||
|
"rayon",
|
||||||
|
"servo_rand",
|
||||||
|
"tempdir",
|
||||||
|
"tempfile",
|
||||||
|
"uuid",
|
||||||
|
"websocket",
|
||||||
|
"ws",
|
||||||
|
]
|
||||||
|
|
||||||
[ignore]
|
[ignore]
|
||||||
# Ignored packages with duplicated versions
|
# Ignored packages with duplicated versions
|
||||||
packages = ["bitflags", "byteorder", "lazy_static", "semver", "libloading"]
|
packages = ["bitflags", "byteorder", "lazy_static", "semver", "libloading"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue