Summary
Broaden Makefile's check-static-regexes scan so hand-rolled static regex declarations cannot bypass the repository's lazy_regex! convention by using lazy-wrapper constructors other than std::sync::LazyLock::new.
Rationale
The current pattern at Makefile Line 46 only detects LazyLock::new(... Regex::new(...)). A declaration using once_cell::sync::Lazy::new(|| Regex::new(...)) is not detected, allowing a prohibited static-regex construction to pass make lint.
Affected area
Makefile: check-static-regexes
- Add focused regression coverage or fixtures for the lint pattern.
Required changes
- Extend the scan to detect direct and fully qualified supported lazy-wrapper constructors, including
once_cell::sync::Lazy::new, in addition to LazyLock::new.
- Define the supported wrapper forms in the regression coverage so each form is rejected when it directly wraps
Regex::new.
- Preserve the existing behaviour:
- a matching prohibited declaration fails with the existing static-regex diagnostic;
- no matches succeed;
- ripgrep scan failures propagate with the existing error handling.
- Keep the change minimal and retain
lazy_regex! as the sole sanctioned idiom for static regex declarations.
- Run every applicable formatting, lint, and test gate before closing the issue.
Acceptance criteria
Backlinks
Summary
Broaden
Makefile'scheck-static-regexesscan so hand-rolled static regex declarations cannot bypass the repository'slazy_regex!convention by using lazy-wrapper constructors other thanstd::sync::LazyLock::new.Rationale
The current pattern at
MakefileLine 46 only detectsLazyLock::new(... Regex::new(...)). A declaration usingonce_cell::sync::Lazy::new(|| Regex::new(...))is not detected, allowing a prohibited static-regex construction to passmake lint.Affected area
Makefile:check-static-regexesRequired changes
once_cell::sync::Lazy::new, in addition toLazyLock::new.Regex::new.lazy_regex!as the sole sanctioned idiom for static regex declarations.Acceptance criteria
LazyLock::new(|| Regex::new(...))static regex is rejected.once_cell::sync::Lazy::new(|| Regex::new(...))static regex is rejected, including qualified constructor spelling.make lintretains its existing result and diagnostic behaviour for clean scans, prohibited declarations, and ripgrep failures.Backlinks