mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
mach(test-tidy): Make wpt lint logic servo-tidy.toml
and optimize checking for changed files (#38511)
Fix wpt lint logic to respect servo-tidy.toml ignores and --all flag Testing: Should be covered on CI Fixes: #38510 #37991 --------- Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
This commit is contained in:
parent
31acac316d
commit
8f52e28225
1 changed files with 9 additions and 5 deletions
|
@ -232,7 +232,8 @@ class FileList(object):
|
|||
|
||||
|
||||
def filter_file(file_name: str) -> bool:
|
||||
if any(file_name.startswith(ignored_file) for ignored_file in config["ignore"]["files"]):
|
||||
current_file = os.path.join(".", relative_path(file_name))
|
||||
if any(current_file.startswith(ignored_file) for ignored_file in config["ignore"]["files"]):
|
||||
return False
|
||||
base_name = os.path.basename(file_name)
|
||||
if any(fnmatch.fnmatch(base_name, pattern) for pattern in FILE_PATTERNS_TO_IGNORE):
|
||||
|
@ -848,7 +849,7 @@ def lint_wpt_test_files() -> Iterator[tuple[str, int, str]]:
|
|||
messages = [] # Clear any old messages.
|
||||
|
||||
suite_directory = os.path.abspath(os.path.join(WPT_PATH, suite))
|
||||
tests_changed = FileList(suite_directory, only_changed_files=True, progress=False)
|
||||
tests_changed = filter_files(suite_directory, only_changed_files=False, progress=False)
|
||||
tests_changed = [os.path.relpath(file, suite_directory) for file in tests_changed]
|
||||
|
||||
if lint.lint(suite_directory, tests_changed, output_format="normal"):
|
||||
|
@ -862,9 +863,12 @@ def run_wpt_lints(only_changed_files: bool) -> Iterator[tuple[str, int, str]]:
|
|||
yield (WPT_CONFIG_INI_PATH, 0, f"{WPT_CONFIG_INI_PATH} is required but was not found")
|
||||
return
|
||||
|
||||
if not list(FileList("./tests/wpt", only_changed_files=only_changed_files, progress=False)):
|
||||
print("\r ➤ Skipping WPT lint checks, because no relevant files changed.")
|
||||
return
|
||||
if only_changed_files:
|
||||
try:
|
||||
FileList("./tests/wpt", only_changed_files=only_changed_files, progress=False).next()
|
||||
except StopIteration:
|
||||
print("\r ➤ Skipping WPT lint checks, because no relevant files changed.")
|
||||
return
|
||||
|
||||
manifests_exist_errors = list(check_that_manifests_exist())
|
||||
if manifests_exist_errors:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue