Skip to content

Build Warnings Log SARIF and JSON reports - #1342

Merged
mkarlesky merged 4 commits into
next_versionfrom
feature/warnings-log-structured-reports
Oct 15, 2026
Merged

mkarlesky merged 4 commits into
next_versionfrom
feature/warnings-log-structured-reports

Conversation

@mkarlesky

Copy link
Copy Markdown
Member

Summary

The Build Warnings Log plugin can now write its warnings as SARIF 2.1.0 and JSON reports, alongside or instead of its plain text log.

  • :reports selects any of :text, :sarif, and :json, as symbols or strings in any letter case. With no setting or an empty list, the plugin writes the text log alone. An unknown entry stops the build with an error naming it.
  • :filename is now a base name (default warnings), and each report adds its own extension (.log, .sarif, .json). A project that set an extension other than .log sees its text log's extension change. This is recorded under ⚠️ Changed.
  • SARIF: each warning is one result:
    • its rule is the warning's flag, and the run lists each flag as a rule;
    • its level is the diagnostic's severity;
    • its location is the file, line, and column. A relative path is relative to the project (%SRCROOT%, with any leading ./ dropped), and an absolute path is a file: URI;
    • its context lines and full text are kept in properties;
    • the run's automationDetails.id names the build context.
  • JSON: a simple layout for scripts, listing each warning's file, line, column, severity, flag, message, context, and text.
  • Empty contexts: the structured reports are written for every build context that ran a build step, even without warnings. A CI upload step therefore always finds its file, and an empty report clears old alerts. The text log is still written only when there are warnings.

The text log is unchanged byte for byte. Deduplication, :patterns, and :excludes work as before.

Implementation

  • WarningCollector#warnings returns records of each warning's text and its parsed diagnostic fields. Output not in GCC's format has only its text and message.
  • WarningReports holds one small renderer per format.

Docs

  • The plugin page has new Filename and Reports sections with an example of each report, an explanation of SARIF with links to the specification and the tools that read it, and a GitHub Actions upload-sarif@v4 step.
  • The Changelog has an Added entry and a Changed entry.
  • Four plugin cards in the plugins index are refreshed for this week's plugin changes.

Testing

  • Unit specs cover record parsing (Windows drive letters, missing columns, non-option bracketed text, other toolchains' formats), both renderers, filename handling, and :reports validation.
  • Integration specs run real compiler output through all three reports, checking that the structured reports agree with the text log. They pass with Apple Clang locally and with GCC 14 in the madsciencelab-plugins image.
  • rake specs:units and rake specs:integration pass, and lint is clean.

🤖 Generated with Claude Code

mkarlesky and others added 4 commits October 15, 2026 13:57
:reports selects any of :text, :sarif, and :json, defaulting to :text, and
:filename names each report's base, which takes the report's extension.
Warnings are collected as records of their parsed location, severity,
message, flag, and context lines. The structured reports cover every build
context that ran a build step, even one without warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lugin cards

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Older GCC ends some warnings with [enabled by default], which is part of the
message rather than a rule for SARIF to name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mkarlesky
mkarlesky merged commit 1a47d70 into next_version Oct 15, 2026
21 of 22 checks passed
@mkarlesky
mkarlesky deleted the feature/warnings-log-structured-reports branch October 15, 2026 19:42
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.

1 participant