Unified special tag separators on colon and added a docs drift-guard linter.#662
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
WalkthroughRenames accessibility Behat tag separators from dash ( ChangesAccessibility tag syntax migration and validation enforcement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #662 +/- ##
==========================================
+ Coverage 96.80% 96.85% +0.05%
==========================================
Files 46 46
Lines 3757 3817 +60
==========================================
+ Hits 3637 3697 +60
Misses 120 120 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Unifies the library's special Behat tag separator convention so that all parametrized tags consistently use a colon between the tag name and its value (
@prefix:value).AccessibilityTraitwas the only parametrized tag still using a hyphen for the value separator (@accessibility-critical); this PR aligns it with the six other parametrized tags (@module:help,@breakpoint:mobile,@email:default, etc.). A new drift-guard linter indocs.php- executed as part ofahoy lint-docsand gated in CI - enforces the colon convention going forward by scanning all trait docblocks, step examples, and feature files against a canonical tag registry. 180 lines of data-provider-driven PHPUnit tests cover the four new functions at 100% line coverage.BREAKING CHANGE
The seven threshold tags for
AccessibilityTraitnow use a colon separator instead of a hyphen. Consumers must rename these tags in their feature files:@accessibility-critical@accessibility:critical@accessibility-serious@accessibility:serious@accessibility-moderate@accessibility:moderate@accessibility-minor@accessibility:minor@accessibility-any@accessibility:any@accessibility-warning@accessibility:warning@accessibility-strict@accessibility:strictThe bare
@accessibilitytag is unchanged. The hyphen forms no longer resolve and the new linter will reject them.AccessibilityTraitshipped in 3.9.0 / 3.10.0 only, so the blast radius is small.Changes
src/AccessibilityTrait.php@accessibility:critical/@accessibility:seriousetc. instead of the old hyphen forms.accessibilityGetThreshold()to match on:instead of-when extracting the threshold value from the scenario tag.docs.phptag_registry(): canonical map of all 13 special library tags, each classified asparametrized(expects@prefix:value) orflag(stands alone).extract_tags(): extracts@tagtokens from arbitrary text, skipping email addresses and@@sequences, deduplicating results.validate_tag(): checks a single tag against the registry and returns an error message when aparametrizedprefix is followed by-instead of:.validate_tags(): orchestrates validation across all trait descriptions, step examples, and every.featurefile undertests/behat/features/; wired intomain()alongside the existingvalidate()call.tests/phpunit/src/DocsTest.phptestTagRegistry(): smoke-checks registry shape and type values.testValidateTag()withdataProviderValidateTag()(35 cases): valid colon forms, bare tags, flag tags with hyphens in their name, unknown tags, and every violation class.testExtractTags()withdataProviderExtractTags()(15 cases): empty input, email-address skipping,@@skipping, trailing-punctuation stripping, deduplication.testValidateTagsFromInfo(): exercises all branching paths insidevalidate_tags()for in-memory trait info.testValidateTagsFromFeatureFiles(): writes two temporary feature files and asserts that only the dirty one produces an error.testValidateTagsReturnsNoErrorsForCleanInput(): confirms zero errors for fully conforming input.tests/behat/features/accessibility.featureandSTEPS.md@accessibility-*tag references to@accessibility:*.Before / After
PR Summary: Unify Behat Tag Separator Convention to Colons
Objective
Standardize the library's special Behat tag convention to use colons (
:) between tag names and values, aligning parametrized threshold tags inAccessibilityTraitwith existing conventions used in other tags like@module:helpand@breakpoint:mobile.Changes
Documentation Updates
AccessibilityTraitdocumentation to rename supported@accessibilityimpact tags from hyphenated forms (@accessibility-critical,@accessibility-serious, etc.) to colon-suffixed forms (@accessibility:critical,@accessibility:serious, etc.). The bare@accessibilitytag remains unchanged. All threshold semantics preserved.Core Implementation Changes
accessibilityResolveTags()to recognize variant tags by requiring the auto tag prefix followed by:instead of-when extracting and applying threshold/fail-on-incomplete settings.Test Updates
@accessibility-warningand@accessibility-criticalto their colon-based equivalents (@accessibility:warning,@accessibility:critical).New Linter Infrastructure
tag_registry(): Canonical map of 13 special library tags classified as parametrized or flagextract_tags(): Extracts@tagtokens while skipping email addresses and@@sequencesvalidate_tag(): Checks tags against the registry for compliance with colon conventionvalidate_tags(): Orchestrates validation across trait descriptions, step examples, and.featurefilesmain()to integrate tag validation errors into the linting pipeline, executing as part ofahoy lint-docscommand and CITest Coverage
Breaking Change
This PR introduces a breaking change affecting consumers of
AccessibilityTrait. However, the blast radius is small as the trait was only shipped in versions 3.9.0 and 3.10.0.Step Definition Compliance
All step definitions referenced in the modified feature files conform to the CONTRIBUTING.md step definition guidelines. No violations detected.
Effort Assessment