Skip to content

Conversation

@shivammathur
Copy link
Contributor

This PR wraps the foreach loop in cs2pr script in an if condition to handle cases when simplexml_load_string will return false.

This will happen when

  • Input xml file is empty or it does not exist
  • 2 or more arguments are passed to the script.

Ref: https://www.php.net/manual/en/function.simplexml-load-string.php

@staabm
Copy link
Owner

staabm commented Jan 29, 2020

thx. did similar changes in #4 but did not finish it yet.

I will merge this PR in the meantime as I dont have time to finish #4 in the next days

@staabm staabm merged commit 4486f89 into staabm:master Jan 29, 2020
@staabm
Copy link
Owner

staabm commented Jan 29, 2020

tagged a new release https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/tag/1.0.1

@shivammathur
Copy link
Contributor Author

Thanks for the quick release.

@staabm
Copy link
Owner

staabm commented Jan 29, 2020

btw. do you agree that the case of emtpy input should exit with a non-zero exit-code, like I did it in https://github.com/staabm/annotate-pull-request-from-checkstyle/pull/4/files#diff-53aef30a2ab25806980a8b72fd6b9aecR43

?

@shivammathur
Copy link
Contributor Author

shivammathur commented Jan 29, 2020

In my opinion as the script creates annotations for errors, warnings in a tool's output, if the output is empty and no annotations are created the exit code should be zero.

@staabm
Copy link
Owner

staabm commented Jan 29, 2020

I would expect a empty checkstyle result when no warnings/errors are contained, not a complete empty output

@shivammathur
Copy link
Contributor Author

ok, in that case may be output a warning along with non-zero exit code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants