-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return error code when issue exists #31
Conversation
Thanks for your proposal. In my opinion, status code returned by lint tools should be customizable. We should be able to control it by runtime arguments as follows without changing the default behavior.
|
I've updated to match your opinion. |
@@ -148,6 +150,12 @@ func (cli *CLI) Run(args []string) int { | |||
|
|||
p := printer.NewPrinter(cli.outStream, cli.errStream) | |||
p.Print(issues, format) | |||
|
|||
if exitErrorStatus { | |||
if len(issues) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpicks] if exitErrorStatus && len(issues) > 0
@@ -71,6 +72,7 @@ func (cli *CLI) Run(args []string) int { | |||
flags.StringVar(&awsAccessKey, "aws-access-key", "", "AWS access key used in deep check mode.") | |||
flags.StringVar(&awsSecretKey, "aws-secret-key", "", "AWS secret key used in deep check mode.") | |||
flags.StringVar(&awsRegion, "aws-region", "", "AWS region used in deep check mode.") | |||
flags.BoolVar(&exitErrorStatus, "exit-error-status", false, "return exit status code when issue exists.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry... Please use another option name 🙇
I think --exit-error-status
is bad name. (My recommendation is --error-with-issues
)
|
||
if exitErrorStatus { | ||
if len(issues) > 0 { | ||
return ExitCodeError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use another status code. (ex: ExitCodeIssuesFound
, etc.) ExitCodeError
is reserved for execution error.
Great! Finally, Please squash to one commit as well :) |
Thanks! I will release the next version including this PR soon. Please give me feedback again! |
WHY
When used tflint on CI, it's didn't failed although tflint return some errors.
WHAT
Update to return 2 when issue exists.