Repository navigation
feat(#17): surface forwarding call-site line per hop - #18
Merged
Merged
Conversation
A method that forwards a param to the same callee via two distinct call sites yields two findings (Option B, not deduped). They share origin/param/terminal and differ only in the divergent hop's forwardLine, which every reporter surfaces. The fingerprint is shared by design (refactor-stable). Pins the emission rule against a future accidental dedup regression.
Append '→N' (the forwarding call-site line) to each non-terminal hop's location so findings that share origin/param/terminal but differ in call site are distinguishable. Terminal hops keep the plain 'file:line' form. Closes part of #17.
Same '→N' suffix as TextReporter; inherits the location style through Styler::location(). Closes part of #17.
line= now uses forwardLine ?? hop->line so the annotation lands on the forwarding call (the actionable line) rather than the method declaration. The diff-aware changed-anchor selection is untouched. Closes part of #17.
relatedLocations now use forwardLine ?? hop->line for region.startLine so each hop's related location points at the forwarding call. The origin locations[0] keeps the declaration line as the primary anchor. Closes part of #17.
README examples now show the '→N' forwarding call-site suffix, with a short explanation. docs/plan.md §2.3 (Branching) is amended to cover the same-callee-multiple-call-site case explicitly: N findings, shared fingerprint, distinguished by forwardLine. Clarification, not a semantics change.
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.
Closes #17.
See design spec and implementation plan.
Summary
Surface
Hop::forwardLine(the forwarding call-site line) in every reporter that previously hid it, so duplicate findings (one method forwarding a param to the same callee via multiple call sites — e.g.JsonLdLayer::article()callingCardFields::httpUrl()twice at lines 166 and 180) become distinguishable. No finding-emission or fingerprint change (Option B — display, not dedupe).→Nto each non-terminal hop's location (file:line→forwardLine); terminal hops keep plainfile:line.line=usesforwardLine ?? hop->linefor all annotations (anchor + notices).relatedLocationsstartLineusesforwardLine ?? hop->line; originlocations[0]keeps declaration line.forwardLineper hop; unchanged.docs/plan.md).tests/fixtures/same-callee-two-callsites/pins the two-finding emission rule against a future accidental dedup regression.docs/plan.md§2.3 (Branching) amended to cover the same-callee-multiple-call-site case explicitly (clarification, not a semantics change).Verification
composer checkgreen (490 tests, 1581 assertions).composer infection:diffclean on touched code (zero escaped mutants onforwardLine ?? hop->line/→/label()lines; MSI 94% vs 80% gate).simple-feed-reader/backend/srcconfirms the twoJsonLdLayer::articlefindings now distinguish at hop 4::164→166vs:164→180.Side note
PrettyReporter::label()was refactored from two guard clauses tomatch(true)to keep PHPMD WMC under 50 (the newif ($hop->forwardLine !== null)guard inlocation()would have pushed it over). Behavior-preserving, idiomatic PHP 8.0+, flagged transparently in the task report. A structural split ofPrettyReportermay be cleaner if WMC pressure recurs — out of scope for #17.