Skip to content

fix(visitor): record string occurrence for accurate position reporting - #49

Merged
jgautheron merged 1 commit into
jgautheron:masterfrom
TobyTheHutt:45-fix-addstring-position-tracking
Mar 5, 2026
Merged

fix(visitor): record string occurrence for accurate position reporting#49
jgautheron merged 1 commit into
jgautheron:masterfrom
TobyTheHutt:45-fix-addstring-position-tracking

Conversation

@TobyTheHutt

Copy link
Copy Markdown
Contributor

Fix string position tracking so duplicate string literals report all occurrences correctly.

Previously, addString only stored positions for the first occurrence and when minOccurrences was reached, which could under-report locations. The visitor now records every occurrence while still using the existing count map for threshold checks.

Changes:

  • Updated visitor.go to append a position for every matching string occurrence.
  • Unit coverage in visitor_test.go with full position capture across different minOccurrences values.
  • Integration coverage in integration_test.go with end-to-end position counts from testdata.

Resolves: #45

@codecov

codecov Bot commented Mar 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@796e627). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master      #49   +/-   ##
=========================================
  Coverage          ?   66.75%           
=========================================
  Files             ?        4           
  Lines             ?      764           
  Branches          ?        0           
=========================================
  Hits              ?      510           
  Misses            ?      222           
  Partials          ?       32           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
…porting

Signed-off-by: Tobias Harnickell <tobias@harnickell.ch>
@jgautheron
jgautheron force-pushed the 45-fix-addstring-position-tracking branch from b97e6fe to 8a218e3 Compare March 5, 2026 11:24
@jgautheron
jgautheron merged commit 9d94950 into jgautheron:master Mar 5, 2026
7 checks passed
@TobyTheHutt
TobyTheHutt deleted the 45-fix-addstring-position-tracking branch March 5, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants