fix: use grep -F for baseline lookup to handle Go pointer receivers#194
Merged
marcusburghardt merged 1 commit intocomplytime:mainfrom Apr 16, 2026
Conversation
The baseline comparison uses grep with the function key as the pattern.
Go pointer receiver methods use (*Type).Method syntax, where (* is
interpreted as a BRE quantifier ("zero or more open-parens") instead
of the literal characters. This causes all pointer receiver functions
to fail lookup and be misclassified as "new functions", triggering
false CRAP threshold violations in consuming repositories.
Switching to grep -F (fixed-string mode) ensures literal matching.
The ^ anchor is dropped because -F does not support anchors, but
collisions are not possible since keys are fully-qualified
file:function paths unique by construction.
Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regex interpretation bug in the CRAPLoad baseline comparison that
causes all Go pointer receiver methods to be misclassified as "new functions."
Line 177 uses
grep "^${key}<TAB>"to look up function keys in the baselineTSV. Go pointer receiver methods have the format
(*Type).Method, where(*is a BRE (Basic Regular Expression) quantifier meaning "zero or more
("rather than the literal characters
(*. This causes the lookup to fail forevery pointer receiver function.
The fix switches
greptogrep -F(fixed-string matching). The^anchoris dropped because
-Fdoes not support anchors. Collisions are not possiblesince keys are fully-qualified
file.go:functionpaths, unique by construction.Related Issues
Review Hints
Single-line change on line 177 of
reusable_crapload_analysis.yml:grep→grep -F.Evidence from complytime/complyctl PR #473:
113 functions flagged as "new" = exactly 113 pointer receiver functions in
the baseline. 251 functions matched correctly = all non-pointer-receiver
functions.
Reproducible locally: