Skip to content

fix(formatters): render warnings in markdown output#2966

Open
slegarraga wants to merge 1 commit into
stoplightio:developfrom
slegarraga:fix/markdown-renders-warnings
Open

fix(formatters): render warnings in markdown output#2966
slegarraga wants to merge 1 commit into
stoplightio:developfrom
slegarraga:fix/markdown-renders-warnings

Conversation

@slegarraga
Copy link
Copy Markdown
Contributor

Summary

The markdown formatter never rendered warnings, even when --display-only-failures was not passed. Fixes #2928.

Root cause

markdown.ts filtered results with result.severity <= failSeverity. failSeverity defaults to error (DiagnosticSeverity.Error === 0), so only errors survived and warnings (severity 1) were dropped regardless of --display-only-failures.

failSeverity controls the process exit code, not what is displayed. The --display-only-failures filtering is already applied in the CLI before formatting (filterResultsBySeverity in commands/lint.ts), and the other formatters (stylish, text, json, pretty) render every result they receive.

Fix

Drop the redundant failSeverity filter from the markdown formatter so it renders all results it is given, consistent with the other formatters.

Test

Added a regression test asserting warnings are rendered with the default failSeverity of error. The existing markdown test continues to pass.

PASS @stoplight/spectral-formatters packages/formatters/src/__tests__/markdown.test.ts
  Markdown formatter
    ✓ should format as markdown table
    ✓ renders warnings regardless of failSeverity (#2928)

The markdown formatter filtered results by `failSeverity`, so with the
default `failSeverity` of `error` it never rendered warnings, ignoring the
absence of `--display-only-failures`. Result filtering for that flag already
happens in the CLI before formatting, and the other formatters render every
result they receive. Drop the redundant filter.

Closes stoplightio#2928
@slegarraga slegarraga requested a review from a team as a code owner June 3, 2026 01:34
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.

markdown output format ignores absence of --display-only-failures

1 participant