mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
Meta: Validate proper formatting for FIXMEs and AD-HOCs
This commit is contained in:
parent
100f37995f
commit
6951ef4ee3
Notes:
github-actions[bot]
2025-11-14 08:18:28 +00:00
Author: https://github.com/Psychpsyo
Commit: 6951ef4ee3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6810
2 changed files with 14 additions and 3 deletions
|
|
@ -1259,7 +1259,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str
|
|||
if (enable == TriState::True)
|
||||
audio_track->set_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
|
||||
// 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
|
||||
|
|
@ -1318,7 +1318,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str
|
|||
if (enable == TriState::True)
|
||||
video_track->set_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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue