Skip to content

fix(semgrep): capture end.line so multi-line findings use the full annotation range#80

Open
Valyrian-Code wants to merge 1 commit into
RocketChat:developfrom
Valyrian-Code:fix/semgrep-end-line
Open

fix(semgrep): capture end.line so multi-line findings use the full annotation range#80
Valyrian-Code wants to merge 1 commit into
RocketChat:developfrom
Valyrian-Code:fix/semgrep-end-line

Conversation

@Valyrian-Code
Copy link
Copy Markdown

Summary

  • Semgrep's JSON output has both start.line and end.line, but SemgrepRawResult only declared start and toFinding never populated startLine/endLine.
  • Every Semgrep annotation collapsed to a single line even for rules that match multi-line constructs (e.g. multi-line function calls, object literals).
  • The SemgrepFinding type already had startLine?: number and endLine?: number — the implementation just never filled them.

Fix

Added end?: { line: number } to SemgrepRawResult and populate startLine/endLine in toFinding. Falls back to startLine when end is absent.

Test plan

  • New test: single-line finding sets startLine === endLine === start.line
  • New test: multi-line finding sets startLine from start.line and endLine from end.line
  • New test: finding with no end field falls back endLine to startLine
  • Full suite: npm test — 635 tests, 0 failures

…nnotation range

Semgrep emits both start.line and end.line in its JSON output but the
adapter only read start.line and left startLine/endLine unset. Every
Semgrep annotation therefore collapsed to a single line even for rules
that match multi-line constructs. Added end?: {line} to SemgrepRawResult
and populate startLine/endLine in toFinding, falling back to startLine
when end is absent.
Copilot AI review requested due to automatic review settings May 22, 2026 01:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants