From 6951ef4ee3f36ed468c0ebc723a07cc4ca0096aa Mon Sep 17 00:00:00 2001 From: Psychpsyo Date: Thu, 13 Nov 2025 15:12:21 +0100 Subject: [PATCH] Meta: Validate proper formatting for FIXMEs and AD-HOCs --- Libraries/LibWeb/HTML/HTMLMediaElement.cpp | 6 +++--- Meta/check-style.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 45523e1e5ba..94cc0b75590 100644 --- a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -1259,8 +1259,8 @@ WebIDL::ExceptionOr HTMLMediaElement::process_media_data(Functionset_enabled(true); - // AD-HOC(ish): According to https://dev.w3.org/html5/html-sourcing-inband-tracks/, kind should be set according to format, and the following criteria within - // the specified formats. + // NB: According to https://dev.w3.org/html5/html-sourcing-inband-tracks/, kind should be set according to format, and the following criteria within + // the specified formats. // WebM: // - "main": the FlagDefault element is set on the track // - "translation": not first audio (video) track @@ -1318,7 +1318,7 @@ WebIDL::ExceptionOr HTMLMediaElement::process_media_data(Functionset_selected(true); - // AD-HOC(ish): See the comment regarding AudioTrack.kind above with regard to https://dev.w3.org/html5/html-sourcing-inband-tracks/. + // NB: See the comment regarding AudioTrack.kind above with regard to https://dev.w3.org/html5/html-sourcing-inband-tracks/. video_track->set_kind(enable == TriState::True ? "main"_utf16 : "translation"_utf16); // 7. Fire an event named addtrack at this VideoTrackList object, using TrackEvent, with the track attribute initialized to the new VideoTrack object. diff --git a/Meta/check-style.py b/Meta/check-style.py index f6bb76acd66..c35d85b49e1 100755 --- a/Meta/check-style.py +++ b/Meta/check-style.py @@ -57,6 +57,9 @@ LOCAL_INCLUDE_SUFFIX_EXCLUDES = [ # We check for and disallow any comments linking to the single-page HTML spec because it takes a long time to load. SINGLE_PAGE_HTML_SPEC_LINK = re.compile("//.*https://html\\.spec\\.whatwg\\.org/#") +# We similarily check and disallow AD-HOCs and FIXMEs that aren't followed by a colon. +INVALID_AD_HOC_OR_FIXME = re.compile(r'^(?:[\s\d./\-(*]+(?:AD-HOC|FIXME)[^:]|.*"FIXME[^:"]).*$', re.MULTILINE) + def should_check_file(filename): if not filename.endswith(".cpp") and not filename.endswith(".h"): @@ -97,6 +100,7 @@ def run(): errors_include_missing_local = [] errors_include_bad_complex = [] errors_single_page_html_spec = [] + errors_invalid_ad_hoc_or_fixme = {} for filename in find_files_here_or_argv(): with open(filename, mode="r", encoding="utf-8") as f: @@ -146,6 +150,9 @@ def run(): errors_include_missing_local.append(filename) if SINGLE_PAGE_HTML_SPEC_LINK.search(file_content): errors_single_page_html_spec.append(filename) + invalid_ad_hocs_or_fixmes = INVALID_AD_HOC_OR_FIXME.findall(file_content) + if invalid_ad_hocs_or_fixmes: + errors_invalid_ad_hoc_or_fixme[filename] = invalid_ad_hocs_or_fixmes have_errors = False if errors_license: @@ -184,6 +191,10 @@ def run(): if errors_single_page_html_spec: print("Files with links to the single-page HTML spec:", " ".join(errors_single_page_html_spec)) have_errors = True + if errors_invalid_ad_hoc_or_fixme: + for file in errors_invalid_ad_hoc_or_fixme: + print(f"{file} contains invalid AD-HOC or FIXME usages:", "".join(errors_invalid_ad_hoc_or_fixme[file])) + have_errors = True if have_errors: sys.exit(1)