Skip to content

Add diagnosticReporter config option#1701

Open
chrisdp wants to merge 3 commits intomasterfrom
feature/diagnostic-reporters
Open

Add diagnosticReporter config option#1701
chrisdp wants to merge 3 commits intomasterfrom
feature/diagnostic-reporters

Conversation

@chrisdp
Copy link
Copy Markdown
Contributor

@chrisdp chrisdp commented May 6, 2026

Summary

  • New diagnosticReporter setting (and --diagnostic-reporter CLI flag) selecting how diagnostics are rendered: "detailed" (default), "github-actions", or a custom {file}:{line}: {message} template
  • Accepts an array so multiple reporters run per build (e.g. detailed terminal output + GitHub Actions PR annotations from the same CI run, no third-party tool needed)
  • Invalid values are warned about and skipped; all-invalid falls back to "detailed" (never aborts the build)

chrisdp added 2 commits May 6, 2026 10:22
Adds a new `diagnosticReporter` setting in bsconfig.json (and a matching
`--diagnostic-reporter` CLI flag) that lets users pick how diagnostics are
rendered to the console. Accepts a single value or an array, where each
value is a preset name ("detailed", "github-actions"), a custom template
string, or an explicit object form. Multiple reporters can run in the same
build so a CI run can emit detailed terminal output and GitHub Actions PR
annotations simultaneously without a third-party tool.

Invalid reporter values are logged and skipped rather than aborting the
build; if every configured reporter is invalid the build falls back to
"detailed". Schema and docs/bsconfig.md updated.
Comment thread src/BsConfig.ts
*
* @default "detailed"
*/
diagnosticReporter?: DiagnosticReporter | DiagnosticReporter[];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be plural from the start? diagnosticReporters?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes — updated to diagnosticReporters as the primary terminology in commit 3d4e42b (with a compatibility fallback for the singular key).

Comment thread src/ProgramBuilder.ts
Comment on lines +376 to +384
for (const reporter of reporters) {
if (reporter.type === 'github-actions') {
diagnosticUtils.printDiagnosticGithubActions({ options: options, severity: severity, filePath: filePath, diagnostic: diagnostic });
} else if (reporter.type === 'custom') {
reporter.run({ options: options, severity: severity, filePath: filePath, diagnostic: diagnostic });
} else {
diagnosticUtils.printDiagnostic(options, severity, filePath, lines, diagnostic, relatedInformation);
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot add tests that make sure reporters are called in the order the user defined them. Cover when configured via bsconfig.json and cli.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added reporter-order coverage in ProgramBuilder.spec.ts for both bsconfig-driven and CLI-driven configuration in commit 3d4e42b.

Comment thread src/BsConfig.ts
*
* @default "detailed"
*/
diagnosticReporter?: DiagnosticReporter | DiagnosticReporter[];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot Lets update this terminology to diagnosticReporters

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Terminology has been updated to diagnosticReporters across config/CLI/docs in commit 3d4e42b.

Copilot finished work on behalf of chrisdp May 7, 2026 15:49
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.

3 participants