golangci-lint icon indicating copy to clipboard operation
golangci-lint copied to clipboard

Return zero on non-error findings

Open ajhenry opened this issue 3 years ago • 2 comments

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!

ajhenry avatar Aug 12 '22 15:08 ajhenry

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

boring-cyborg[bot] avatar Aug 12 '22 15:08 boring-cyborg[bot]

seems like a duplicate of #1981

https://github.com/golangci/golangci-lint/pull/2595#issuecomment-1043739800

ldez avatar Aug 12 '22 16:08 ldez