-
Notifications
You must be signed in to change notification settings - Fork 240
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
Forbid new check warnings #2404
Forbid new check warnings #2404
Conversation
Sample of Travis output when a new problem is detected: https://travis-ci.org/infotroph/pecan/jobs/580354445#L6106-L6128 |
Apparently R check now does some static analysis and complains about "unstated dependencies in tests" because of these lines even though they never run. Easier to remove them than to fight it.
It's still marked as "Draft", so not sure if a formal review is appropriate, but in general, this looks super useful -- thanks for putting it together! |
@ashiklom I marked this as draft to emphasize that I wanted feedback before it was merged, so reviews are very helpful. If the overall approach seems sound, I'll make whatever other tweaks are needed to make the build pass and then solicit a final round of review. |
No idea why this complains on Travis but not locally, but whatever
I would like to see this go in sooner rather than later, especially given the flurry of PEcAn development that will be happening in anticipating of upcoming meetings. So feel free to drop the "Draft" status whenever you're ready so we can give this a formal review. If you have the time, one thing that would help this PR is adding a brief (maybe even just in bullet form) section on "Continuous Integration / Travis" to our documentation. I think this would work as either an appendix, a sub-section of "Developer Guide -> Testing", or maybe even a full section under "Developer Guide". I would be perfectly happy with just a list of checks that are performed on Travis and a few notes about solving common errors (e.g. forgetting to run |
R 3.5 reports the bare Rd filename, R >= 3.6 reports it as `man/<file>.Rd`. Decided it was easier to fix the error than to make the script handle it gracefully
Saw where the files are needed. |
@robkooper We need them (the code compares each new check result against |
#' @return | ||
#' @return A list with two entries: | ||
#' * `sys`: Exit value returned by the workflow (0 for sucess). | ||
#' * `outdir`: Path where the workflow results are saved |
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.
@ashiklom please verify this is a sensible return type description
unlist(lapply(msg, function(x)paste(x[[1]], x[-1], sep=": "))) | ||
} | ||
|
||
old_file <- file.path(pkg, "tests", "Rcheck_reference.log") |
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.
This answers my own question about the Rcheck_reference.log
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'd would suggest to commit. That way people can fix a WARNING/ERROR etc and commit it so it is easy to see warnings being fixed instead of having this ever changing pull request.
@@ -49,7 +49,7 @@ sda.enkf <- function(settings, | |||
host <- settings$host | |||
forecast.time.step <- settings$state.data.assimilation$forecast.time.step #idea for later generalizing | |||
nens <- as.numeric(settings$ensemble$size) | |||
processvar <- settings$state.data.assimilation$process.variance %>% as.logical() | |||
processvar <- as.logical(settings$state.data.assimilation$process.variance) |
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.
TODO before merging:
|
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.
This looks great, thanks again for your hard work on this!
book_source/02_demos_tutorials_workflows/05_developer_workflows/04-testing.Rmd
Outdated
Show resolved
Hide resolved
book_source/02_demos_tutorials_workflows/05_developer_workflows/04-testing.Rmd
Outdated
Show resolved
Hide resolved
* Retrieves any cached files available from previous Travis builds. | ||
- The main thing in the cache is previously-installed dependency R packages, to avoid recompiling them every time. | ||
- If the cache becomes stale or is preventing a package update needed by the build (e.g. to get a new version that contains a needed bug fix), delete the cache through the Travis web interface and it will be reconstructed on the next build. | ||
- Because PEcAn has so many dependencies, builds with no cache will spend most of their time recompiling packages and will often run out of time before the tests complete. You can fix this by [triggering a custom build](https://blog.travis-ci.com/2017-08-24-trigger-custom-build) using a custom config that installs but does not test PEcAn (e.g. `script: make install`), waiting for this to finish and upload its new cache, then restarting the standard full build. |
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.
This is an excellent suggestion. I did not know about this workaround.
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.
@infotroph I was about to merge this, but then I noticed all these new get.model.output.[MODEL]
functions, all of which are dummy functions. What do these do and why are they being added?
@mdietze Unless I'm missing something, I only see one new That said, for the |
@mdietze the No idea why this showed up now but not in the stored check results file, but I figured the quickest fix was to add the dummy function so that Roxygen would regenerate the Rd with correct formatting (and with the correct filename). I'm happy with either of @ashiklom's suggestions (add error or delete) and will do whichever the boss says. |
…s/04-testing.Rmd Co-Authored-By: Alexey Shiklomanov <alexey.shiklomanov@gmail.com>
…s/04-testing.Rmd Co-Authored-By: Alexey Shiklomanov <alexey.shiklomanov@gmail.com>
Description
Experimental, opening PR for discussion but not confident this is the right approach.Opinions, please!Increments the strictness of PEcAn's package checks by forbidding newly added WARNINGs or NOTEs without breaking the build for the (many) pre-existing messages.
In keeping with #1949, the idea here is to move toward eventually requiring all changes to maintain a clean
devtools::check
result: Many check messages indicate issues with potentially severe consequences even if are labeled as "WARNING" or "NOTE" rather than "ERROR", and it's preferable to to fix even the minor-looking issues so that we don't miss the severe ones in the noise.Since #2174, all packages are checked during Travis builds and the build is marked broken if any ERRORs are found. It would be very simple to ratchet this up to break on any WARNING, but fixing all existing warnings from legacy code would be a big undertaking and we might accumulate new warnings faster than we fixed old ones.
What I proposed in #1949 was to blacklist a slowly growing list of warning types, e.g. fix all
'::' or ':::' import not declared
and break the build on new ones, then tackleUndocumented code objects
, and so on. On consideration this still feels Sisyphean, so what I propose here is an across-the-board grandfather clause: We cache current check outputs and break the build on any message newly added by the current build, while continuing to let existing messages slide like we have been doing. This should enforce good practice in newly added code without forcing too much immediate cleanup in the old stuff. As historic warnings get cleaned up in future refactorings, we can update the cached check results to make sure they stay gone.Motivation and Context
Review Time Estimate
Types of changes
Checklist: