-
Notifications
You must be signed in to change notification settings - Fork 280
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
Fail on yaml lint errors #738
Conversation
I don't really know why the build fails, it seems that it fails on all the tests. I'm not good enough in Ruby to analyze the issue though. |
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.
Thanks for this PR, @Gui13. Can you fix the syntax error?
if result.stdout.include? "error" | ||
return [:fail, result.stdout] | ||
else | ||
return [:warn, result.stdout] |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -34,9 +34,22 @@ | |||
) | |||
end | |||
|
|||
it { should warn } | |||
it { should fail } |
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.
Note that fail
is a keyword in Ruby so this test will always error (see the failing TravisCI run).
You should use the fail_hook
keyword here and below.
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.
Ok, it is done. I admit ruby is not my main language. I took inspiration from the existing code in this matter.
@sds I have rebased on your current master just in case. The three failing tests are out of my scope, so I don't know what else to do. In any case, this is what we use right now in production: it correctly handles error messages from yamllint |
return [:fail, result.stdout] | ||
else | ||
return [:warn, result.stdout] | ||
end | ||
end |
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.
The test failure is because the way this if
/else
is written could be simplified.
You can resolve by writing as:
if result.success?
:pass
elsif result.stdout.include?("error")
[:fail, result.stdout]
else
[:warn, result.stdout]
end
Notice this is "flatter" than what is currently written.
Note that there are still CI failures that should be pretty easy to fix. Can you have a look?
|
OK @sds I did it! |
Thank you for your help! |
Fixes #737