You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: Set nonzero exit code with --critical #42
For automation purposes, it would be a great feature to be able to analyze repositories and get a machine readable exit code that states that critical issues were found.
One way is to directly have --critical set the exit code or add another flag that does that if critical issues were found.
That's a good idea. We'd definitely want a way to distinguish between runtime errors (e.g., repository was corrupt) vs. size "errors"; for example, by returning different exit codes.
I like this idea and I have some time to work on it. @mhagger did you maybe have some recommended exit codes in mind? I'm not aware of any standard command line error codes we could reuse.
Following @mingalsuo description updating the tool to support custom user defined exit codes could be an approach. Have the user provide a config file with them listed.
Activity
mhagger commentedon Jun 12, 2018
That's a good idea. We'd definitely want a way to distinguish between runtime errors (e.g., repository was corrupt) vs. size "errors"; for example, by returning different exit codes.
sspaink commentedon Oct 2, 2018
I like this idea and I have some time to work on it.
@mhagger did you maybe have some recommended exit codes in mind? I'm not aware of any standard command line error codes we could reuse.
Following @mingalsuo description updating the tool to support custom user defined exit codes could be an approach. Have the user provide a config file with them listed.
ls-jad-elkik commentedon Feb 22, 2022
A "nice" workaround is to use JSON output and jq.
To just display the results:
To set the exit code to 1 when all is good (there is no match >= threshold):
Then you can "reverse" the exit code.
You can tweak the threshold in
select (.levelOfConcern >= 1), or a bit fancier with an env var:This can be further cleaned up in a nice zsh/bash wrapper file and/or a nice jq script file.
murayamajpeg commentedon May 25, 2024
git cat-file -p :