Skip to content

fail_level has no effect when filter_mode (default: added) filters out all issues #853

Description

@softorwhite

Problem

fail_level appears to have no effect when all golangci-lint findings are
filtered out by filter_mode (default: added). This is especially confusing
because:

  1. The README recommends migrating from the deprecated fail_on_error to
    fail_level, implying it controls job failure.
  2. golangci-lint still produces ##[error] annotations in the job log via
    stderr, so the user sees errors but the job succeeds.

Steps to reproduce

  • action-golangci-lint version: v2.10.0
  • reviewdog version: v0.21.0
- uses: reviewdog/action-golangci-lint@v2
  with:
    fail_level: warning
    # filter_mode defaults to "added"
  • golangci-lint finds issues on lines that already existed (not added in the PR).
  • The CI log shows ##[error] annotations for each finding.
  • The job still succeeds because reviewdog's filter_mode: added filters out
    all issues before fail_level is evaluated.

Root cause

In reviewdog.go,
ShouldFail is only evaluated for diagnostics where check.ShouldReport is
true (i.e., diagnostics that survive the filter_mode filter):

if !check.ShouldReport {
    // skipped — never checked against failLevel
} else {
    shouldFail = shouldFail || w.failLevel.ShouldFail(check.Diagnostic.GetSeverity())
}

So when filter_mode: added removes all findings, shouldFail stays false
and reviewdog exits 0 regardless of fail_level.

Suggestion

  • Documentation: Clarify in the README that fail_level only applies to
    issues that pass the filter_mode filter, and that the default added mode
    may silently suppress all failures.
  • UX (optional): Consider logging a warning when golangci-lint reports
    issues but all are filtered out, so users understand why the job succeeded
    despite ##[error] annotations in the log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions