Skip to content

Read a log error's message from where "error:" matched, not the first "error" in the line [patch] - #416

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix/415-error-message-after-match
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix/415-error-message-after-match

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #415

What changed

  • GitHub.ParseLogForErrors found error lines with ErrorPatternRegex(), but it took the message from the first colon after the first error anywhere in the line. If a path contained "error" (src/errors.c, a repo named error-codes), the Errors column showed 12:5: error: 'x' undeclared instead of 'x' undeclared. It also counted the same compiler error at two locations as two different errors.
  • The message now starts right after the regex match.
  • ParseLogForErrors is now internal so the test project can call it. The test project already sees internals through InternalsVisibleTo.

Tests

  • New GitHubLogErrorsTests covers:
    • the two lines from the issue
    • de-duplicating one error reported at two locations
    • the control case from the issue
    • ##[error] annotations and plain leading Error: lines, which behave as before
  • With only the parsing fix reverted (the internal change kept), 3 of the 5 tests fail, the same 3 the issue describes. With the fix, all pass.
  • The full suite passes: 194 tests, unit and UI.

Generated by Claude Code

…he first "error" in the line

ParseLogForErrors cut a compiler-style line at the first colon after the
first "error" anywhere in it, so a path like src/errors.c or a repository
named error-codes left a "line:col: error:" prefix on the message, and the
same error at two locations was reported twice. The message now starts
right after the ErrorPatternRegex match.

Fixes #415

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW3WKKpY45VJvchCp92
@sonarqubecloud

Copy link
Copy Markdown

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.

Errors column shows "12:5: error: 'x' undeclared" instead of "'x' undeclared" when the file path contains "error"

2 participants