Adds new lint rule to detect test overlap in web feature files#58827
Adds new lint rule to detect test overlap in web feature files#58827ChrisC wants to merge 3 commits intoweb-platform-tests:masterfrom
Conversation
|
57 files with existing overlap seems like a lot, and needing to suppress a lint in so many cases suggests it will need to be suppressed regularly. What kind of overlap is the most typical here, is it when two features have explicitly listed the same file, when wildcards overlap with explicit file names, or overlapping wildcards? I'm wondering if the lint could be limited to avoid the most common scenario here. |
|
I think we should address the exclusion schema in RFC 237 first. If we have a fine-grained exclusion schema (like exclude_ids: at the rule level), we don't have to use lint.ignore for the entire file. Using lint.ignore creates a permanent blind spot in that file where future, unintentional overlaps can slip through (bit rot). If we fix it in the schema, the linter can stay active and protect the rest of the file from bit rot. |
Yeah, I think I agree that waiting on the resolution of the mentioned RFC is the most prudent move here for this reason. But to answer @foolip's earlier question, the overwhelming majority of overlaps have to do with some combo of wildcard or recursive ( Only 3 cases are explicit filename collisions:
These all do some to be pretty intentional and should be added to |
Adds a new
OVERLAPPING-WEB-FEATURES-FILElint rule that detects when the same test file is mapped to multiple features within a singleWEB_FEATURES.ymlfile. (Overlap detection is file-based, not pattern-based: patterns are resolved to actual filenames first, so intentional exclusion patterns do not accidentally trigger the error.)Error message design
Errors are grouped one per overlapping feature pair rather than one per overlapping file. This keeps output manageable in cases where many files are shared between two features. The message lists up to the first 5 overlapping filenames, followed by "and N more" for larger overlaps. Example:
Silencing intentional overlaps
Authors who intentionally map the same test to multiple features (e.g. a test of two closely related features) can suppress this error using the existing lint.ignore mechanism:
OVERLAPPING-WEB-FEATURES-FILE: path/to/WEB_FEATURES.yml(One downside of this approach is that it will be hard to selectively ignore specific overlaps within a single
WEB_FEATURE.yml. It's possible that some future updates to theWEB_FEATURES.ymlschema could more expressively address situations where overlap is intended.)Existing overlaps
Currently, there are 57
WEB_FEATURES.ymlfiles in the repo that already have overlapping mappings. For simplicity, I'm just assuming those are all intentional for now, and have added them tolint.ignore. So this PR introduces no new lint failures. Happy to revisit this added IGNORE list either in this PR or in a follow-up PR.