Closed plod closed 7 years ago
Exit status is the first FAQ entry.
(also you can fence blocks with ``` to correctly quote them as code)
I read FAQ entry 1 but I was expecting warnings not to turn on the first bit (unless the linter had' been configured with severity "error") or am I still misunderstanding?
You are misunderstanding: warnings and errors are both treated as "issues". That said, I'd be fine with an extra exit status bit for errors.
this is the behaviour I thought I was getting, but any exit code of > 0 is causing CI to fail on other projects, trying to think of a way to solve this, I guess extra status bit for errors we could script for that.
The idea is to exit with 0 if only warnings were generated, but still print them. For example, CI build should stop on vet errors, but continue for golint warnings. And we want to achieve this without bash and grepping. In Makefile terms the following is roughly equivalent:
check:
gometalinter --errors
- gometalinter
Here -
ignores command's exit code.
Since this is likely a breaking change, it can be enabled by (yet another) flag. What do you think?
A separate exit status bit seems more generally useful to me, though it too could break backwards compatibility somewhat.
But this will require an additional check with shell scripting: non-zero exit status stops make targets, bash command sequences and almost everything else.
How about
--errors Ignore linter warnings in exit status and hide them.
--ignore-warnings Ignore linter warnings in exit status, but still show them.
I do not want to add flags for tweaking minor, niche behaviours. Given that this is the first time anybody has ever wanted this, I don't think it is very common to want to display warnings but not act on them.
Feel free to send a PR to implement the extra status bit.
I also expected --severity=thing:warn
to return 0 and not 1. The README/FAQ doesn't appear to cover what the possible severity states are. (Is it actually warning
?)
I would assume that if warn
also returns 1, that a --severity=thing:info
would exist which would result in a return code of 0.
I don't think it is very common to want to display warnings but not act on them.
You want to introduce gometalinter
into your project, but you don't have the time to act on all of the warnings immediately.
A work around would be to run gometalinter
with the specific linters disabled, and then run gometalinter
again enabling only those specific linters, or'ing the command to || true
.
As far as I understand it unless a linter returns a severity error or is configured to do so :
However when there is just warnings the process exits with 1
I was expecting the warnings to cause the program to exit with 0, have I not understood something or is this a bug?