Skip to content
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

Variant that exits (with a non-zero error code) if the check fails #51

Closed
jimhester opened this issue Oct 24, 2017 · 11 comments
Closed

Comments

@jimhester
Copy link
Member

This is useful for use in CI systems which fail the build when a command returns a non-zero exit status.

Could be a option in the print.rcmdcheck method or just an option in rcmdcheck::rcmdcheck() directly maybe.

@jimhester jimhester changed the title Variant that exists (with a non-zero error code) if the check fails Variant that exits (with a non-zero error code) if the check fails Oct 24, 2017
@gaborcsardi
Copy link
Member

IDK, it feel awkward if a function call can exit from your session. Maybe this could be handled by the script that calls it? E.g.

R -e 'rc <- rcmdcheck::rcmdcheck(); q(status = length(failures(rc)))'

(The failures function does not exist currently.)

@gaborcsardi
Copy link
Member

Or we can have another function that is a small wrapper?

@jimhester
Copy link
Member Author

Yeah another function would work. It doesn't have to call q(), it can just return an error with stop() and that sets the exit status appropriately if it is the last command.

$ R -q -e 'stop()'
> stop()
Error:
Execution halted
$ echo $?
1

@gaborcsardi
Copy link
Member

Yeah, stop is better.

@gaborcsardi
Copy link
Member

gaborcsardi commented Oct 25, 2017

Do you want to fail on NOTEs as well? Probably not, right?

@gaborcsardi
Copy link
Member

Btw. why would you run rcmdcheck on the CI, instead of just R CMD check?

@ClaytonJY
Copy link

Jim started this partially from a discussion we had on Ropensci; I want to use rmdcheck in CI because I think it (or devtools::check currently) gives superior output, and because I want my CI output to match what I get locally with RStudio + devtools. No more "why do I get these complaints locally, but not on CI?".

@jimhester
Copy link
Member Author

I think having an option whether to stop for errors, warnings or notes makes the most sense.

@gaborcsardi
Copy link
Member

But you don't actually want to stop when a NOTE/WARNING/ERROR happens, right? Only after the check is complete?

@jimhester
Copy link
Member Author

Yeah

@gaborcsardi
Copy link
Member

OK, added an error_on argument, please check it out.

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

No branches or pull requests

3 participants