Skip to content

Ignore the because() reason when matching baseline violations#637

Open
fain182 wants to merge 1 commit into
mainfrom
fix/baseline-self-explanatory-because-matching
Open

Ignore the because() reason when matching baseline violations#637
fain182 wants to merge 1 commit into
mainfrom
fix/baseline-self-explanatory-because-matching

Conversation

@fain182

@fain182 fain182 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Improvement

Q A
New Feature no
BC Break no
Issue Related to #636

Summary

Changing only the because() text of a rule has no real meaning for baseline matching: it changes neither the rule nor the violation it explains, so it shouldn't make existing baseline entries look invalidated.

Today this happens to work for violations whose message has a , but part (e.g. dependency rules), only because everything after , but because() included — is already dropped from the comparison for an unrelated reason (so that changing the rule's configuration doesn't invalidate the baseline either). For self-explanatory messages (e.g. IsFinal, IsReadonly, HaveNameMatching), there's no , but part, so the whole message — because() included — is used as-is, and rewording it breaks the match.

This PR makes the because() reason excluded from baseline matching in general, instead of it only working as a side effect for some message formats.

…ine violations

Rewording a rule's because() text shouldn't make existing baseline
entries for self-explanatory violations (no ", but ") look "new" or
"fixed" again, since the underlying violation hasn't changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@fain182 fain182 changed the title Ignore the because() reason when matching self-explanatory baseline violations Ignore the because() reason when matching baseline violations Jun 30, 2026
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.25%. Comparing base (80cae2e) to head (366f273).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #637   +/-   ##
=========================================
  Coverage     98.25%   98.25%           
- Complexity      700      701    +1     
=========================================
  Files            87       87           
  Lines          2000     2003    +3     
=========================================
+ Hits           1965     1968    +3     
  Misses           35       35           
Files with missing lines Coverage Δ
src/Rules/Violations.php 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant