Repository navigation
Cleanup and unification for covr 4.0 - #758
Merged
Merged
Conversation
Upkeep pass based on reviews of the whole package and the `usethis::use_tidy_upkeep_issue()` checklist. ## Breaking changes - Remove `azure()` (use `cobertura(x, file = "coverage.xml")`) and `package_coverage(pre_clean =)`. - `display_name()` is no longer exported. - `cobertura()`, `sonarqube()`, `lcov()` and `badge()` take `x` and `file`, like `report()`; `to_cobertura()`/`to_sonarqube()` keep their old arguments and still warn. - One reader for settings given as options or `COVR_*` environment variables: the option always wins (this flips `COVR_FIX_PARALLEL_MCEXIT`), and `true/t/yes/1`, `false/f/no/0` are accepted in any case. - `covr.gcov` is no longer set at load; gcov is looked up when needed with the build tools on the `PATH`. - `coveralls()` returns its response invisibly and errors (`covr_coveralls_error`) on non-200 or non-JSON responses. ## Improvements and fixes - httr -> httr2 for uploads, via one mockable `http_request()` in `R/http.R` (no imports, #623); retries connection failures, 429 and 5xx. - `sonarqube()` includes compiled code and branch data; highlight.js 11 in reports. - Fix coverage of files whose names start with `tests`/`branches`, restoring `Vectorize()`/`memoise()` wrapped functions, braces in names in `print()`, filesystem roots, unanchored package path matching, stale `.gcov` files, C++23 instrumentation, Coveralls temp file and `COVERALLS_REPO_TOKEN`, current Drone variables, compiled-session cache invalidation. ## Structure, docs and tests - Split `R/covr.R` into `trace.R`, `merge.R`, `function_coverage.R`, `file_coverage.R`, `with_coverage.R`, `package_coverage.R`, `covr_error.R`; every `test-X.R` matches an `R/X.R`. - Remove help pages of internal functions, document all options, explicit pkgdown reference index, updated `how_it_works` vignette. - No code outside `test_that()`, snapshots instead of unclassed `expect_error()`, temp files cleaned up, no writes into fixtures, fix an order-dependent test. - Upkeep: tidy DESCRIPTION, prune `.Rbuildignore`, air instead of styler in PR workflows, workflows updated to current r-lib templates, `pak::pak()` in README, new logo/favicons; remove `performance-audit/`, `revdep/`, unused `TestUseTry` fixture and `testthat-problems.rds`.
# Conflicts: # R/cobertura.R # R/compiled_session.R # R/covr.R # R/rust.R # R/sonarqube.R # tests/testthat/_snaps/compiled_session.md # tests/testthat/test-sonarqube.R
- Add tests for `annotate_coverage()` sources read from the package and lines past the end of a file, `instrument_installed_package()` failing midway, `has_sysdata_functions()` with data only and with full traversal, `restore_counters()` without counters, `add_hooks()` with an unrecognised loader script, `write_llvm_profile()` with an unloaded DLL, an uninstrumented Rust build in the session, and `format_messages()` and `range_pieces()` with no lines. - Remove the unused `count()` and the unreachable non-call guard in `has_count_call()`, as instrumented code calls `covr_count()`. - Exclude the out of memory path of the C counter table with `# nocov`.
The self-coverage run warns that 2 R processes loaded covrShim and did not save a trace, not 1. The second one is the child of the "package_coverage reports killed code shown while it runs" test: `run_r_live()` starts `R --vanilla --quiet -f TestS4-commands.Rout`, which loads `library(TestS4)` (registering a pending marker for the outer, instrumented covrShim) and then kills itself with SIGKILL. Found by logging the pid and `commandArgs()` of every `register_trace()` and `save_trace_and_clear()` call in a throwaway copy and listing the pids that registered but never saved.
httr2 >= 1.2.0 needs R >= 4.1, so the R 4.0 job couldn't resolve `httr2 (>= 1.0.4)` from its CRAN snapshot.
…tion** - Tests no longer hardcode Unix roots where covr normalizes paths (`/` is `C:/` on Windows), and compare paths after normalizing them (short vs long temp paths, mixed slashes). - The `system_output()` snapshot ignores the quote style of `shQuote()`, which differs on Windows. - The R 4.0 job ignores `paws.common`, which the pinned httr2 only suggests but needs R >= 4.1.
…testthat versions** - Read the request headers with `httr2::req_dry_run()` rather than `req_get_headers()`, which httr2 1.1.2 (the last version for R 4.0) lacks. - Ignore the trailing period of testthat's "Test failures" error in the snapshot, which older testthat versions leave out.
`httr2::req_dry_run()` of httr2 1.1.2 returns the headers unredacted, and only redacts them when printing.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upkeep pass based on reviews of the whole package and the
usethis::use_tidy_upkeep_issue()checklist.Breaking changes
azure()(usecobertura(x, file = "coverage.xml")) andpackage_coverage(pre_clean =).display_name()is no longer exported.cobertura(),sonarqube(),lcov()andbadge()takexandfile, likereport();to_cobertura()/to_sonarqube()keep their old arguments and still warn.COVR_*environment variables: the option always wins (this flipsCOVR_FIX_PARALLEL_MCEXIT), andtrue/t/yes/1,false/f/no/0are accepted in any case.covr.gcovis no longer set at load; gcov is looked up when needed with the build tools on thePATH.coveralls()returns its response invisibly and errors (covr_coveralls_error) on non-200 or non-JSON responses.Improvements and fixes
http_request()inR/http.R(no imports, Running covr for httr/R6 lead to cyclic namespace dependency failure #623); retries connection failures, 429 and 5xx.sonarqube()includes compiled code and branch data; highlight.js 11 in reports.tests/branches, restoringVectorize()/memoise()wrapped functions, braces in names inprint(), filesystem roots, unanchored package path matching, stale.gcovfiles, C++23 instrumentation, Coveralls temp file andCOVERALLS_REPO_TOKEN, current Drone variables, compiled-session cache invalidation.Structure, docs and tests
R/covr.Rintotrace.R,merge.R,function_coverage.R,file_coverage.R,with_coverage.R,package_coverage.R,covr_error.R; everytest-X.Rmatches anR/X.R.how_it_worksvignette.test_that(), snapshots instead of unclassedexpect_error(), temp files cleaned up, no writes into fixtures, fix an order-dependent test..Rbuildignore, air instead of styler in PR workflows, workflows updated to current r-lib templates,pak::pak()in README, new logo/favicons; removeperformance-audit/,revdep/, unusedTestUseTryfixture andtestthat-problems.rds.