зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #12576 - Issue #12421: tidy should also check .html files (from simartin:issue_12421); r=jdm
./mach test-tidy should also check .html files, to avoid patches containing badly formatted new test cases go unnoticed --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12421 - [X] There are tests for these changes (./mach test-tidy failed without the changes to .hrml files) Source-Repo: https://github.com/servo/servo Source-Revision: 93004ce57999947f51067d680c6fde056741331a
This commit is contained in:
Родитель
e12aef3aeb
Коммит
f267f6f076
|
@ -27,7 +27,7 @@ MAX_LICENSE_LINESPAN = max(len(license.splitlines()) for license in licenses)
|
|||
# File patterns to include in the non-WPT tidy check.
|
||||
FILE_PATTERNS_TO_CHECK = ["*.rs", "*.rc", "*.cpp", "*.c",
|
||||
"*.h", "Cargo.lock", "*.py", "*.sh",
|
||||
"*.toml", "*.webidl", "*.json"]
|
||||
"*.toml", "*.webidl", "*.json", "*.html"]
|
||||
|
||||
# File patterns that are ignored for all tidy and lint checks.
|
||||
FILE_PATTERNS_TO_IGNORE = ["*.#*", "*.pyc"]
|
||||
|
@ -44,6 +44,11 @@ IGNORED_FILES = [
|
|||
os.path.join(".", "tests", "wpt", "metadata-css", "MANIFEST.json"),
|
||||
os.path.join(".", "components", "script", "dom", "webidls", "ForceTouchEvent.webidl"),
|
||||
os.path.join(".", "support", "android", "openssl.sh"),
|
||||
# Ignore those files since the issues reported are on purpose
|
||||
os.path.join(".", "tests", "html", "bad-line-ends.html"),
|
||||
os.path.join(".", "tests", "unit", "net", "parsable_mime", "text"),
|
||||
os.path.join(".", "tests", "wpt", "mozilla", "tests", "css", "fonts"),
|
||||
os.path.join(".", "tests", "wpt", "mozilla", "tests", "css", "pre_with_tab.html"),
|
||||
# FIXME(pcwalton, #11679): This is a workaround for a tidy error on the quoted string
|
||||
# `"__TEXT,_info_plist"` inside an attribute.
|
||||
os.path.join(".", "components", "servo", "platform", "macos", "mod.rs"),
|
||||
|
@ -148,7 +153,7 @@ def filter_files(start_dir, only_changed_files, progress):
|
|||
|
||||
|
||||
def check_license(file_name, lines):
|
||||
if any(file_name.endswith(ext) for ext in (".toml", ".lock", ".json")):
|
||||
if any(file_name.endswith(ext) for ext in (".toml", ".lock", ".json", ".html")):
|
||||
raise StopIteration
|
||||
while lines and (lines[0].startswith(EMACS_HEADER) or lines[0].startswith(VIM_HEADER)):
|
||||
lines = lines[1:]
|
||||
|
@ -168,7 +173,7 @@ def check_modeline(file_name, lines):
|
|||
|
||||
|
||||
def check_length(file_name, idx, line):
|
||||
if file_name.endswith(".lock") or file_name.endswith(".json"):
|
||||
if file_name.endswith(".lock") or file_name.endswith(".json") or file_name.endswith(".html"):
|
||||
raise StopIteration
|
||||
# Prefer shorter lines when shell scripting.
|
||||
if file_name.endswith(".sh"):
|
||||
|
@ -672,7 +677,7 @@ def collect_errors_for_files(files_to_check, checking_functions, line_checking_f
|
|||
|
||||
|
||||
def get_wpt_files(only_changed_files, progress):
|
||||
wpt_dir = os.path.join(".", "tests", "wpt", "web-platform-tests" + os.sep)
|
||||
wpt_dir = os.path.join(".", "tests", "wpt" + os.sep)
|
||||
file_iter = get_file_list(os.path.join(wpt_dir), only_changed_files)
|
||||
(has_element, file_iter) = is_iter_empty(file_iter)
|
||||
if not has_element:
|
||||
|
|
Загрузка…
Ссылка в новой задаче