Skip to content

Return zero on non-error findings #3095

@ajhenry

Description

@ajhenry

Your feature request related to a problem? Please describe.

The program always returns non-zero when there are findings of any severity level. It almost makes severity levels pointless if my CI job always errors on all findings.

For example, I expect that only info findings would return 0:

Config

severity:
  default-severity: error
  rules:
    - linters:
        - revive
      severity: info

Output

Running [golangci-lint-1.47.3-linux-amd64/golangci-lint run --out-format=github-actions --config .golangci.yaml] in [] ...
  ::info file=file/file.go,line=95,col=6::exported: type name will be used as file.FileFilter by other packages, and that stutters; consider calling this Filter (revive)

  Error: issues found
  Ran golangci-lint in 95641ms

Describe the solution you'd like.

I would like the program to return 0 on anything other than error.

Describe alternatives you've considered.

Not too sure if there's a workaround for this. It lowers the confidence of my CI job if I make the lint step non-mandatory because there are only warnings/info.

Additional context.

I am adding linting to an existing codebase and already added 100+ //nolint comments for the error severity levels to be fixed at a later time. But warning and info also return a non-zero code.

If anyone has a solution for this, that would be great!

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions