Fix outstanding linting issues - #348
Open
jamesmbaazam wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate pre-existing {lintr} findings on main so the lint-changed-files workflow stops failing unrelated open PRs, by applying behavior-preserving lint fixes across package R sources and vignettes.
Changes:
- Replaced redundant explicit
return()calls with implicit returns in multiple R functions and vignette helper functions. - Updated several
stop()calls to includecall. = FALSE, and adjusted vignette code to satisfylintrrules (e.g.,sample.int(), removing one-call pipes). - Minor refactors to avoid shadowing (
dist→simulated_stats) and remove unnecessarysprintf()usage inwriteLines().
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vignettes/projecting_incidence.Rmd | Removes redundant return() and replaces one-call %>% filter() with direct filter() calls. |
| vignettes/interventions.Rmd | Removes redundant return() from vignette helper functions. |
| vignettes/epichains.Rmd | Uses sample.int() and removes redundant return()s in vignette helper functions. |
| R/utils.R | Removes redundant explicit returns in internal helpers. |
| R/stat_likelihoods.R | Removes redundant explicit returns, adds call. = FALSE to stop(), and renames a local variable to avoid shadowing. |
| R/simulate.R | Removes redundant explicit returns in simulation functions. |
| R/helpers.R | Removes return(switch(...)) wrappers, adds call. = FALSE to stop(), and uses implicit returns. |
| R/epichains.R | Replaces constant-string sprintf() usage in writeLines() with plain strings. |
| R/borel.R | Removes redundant explicit returns and adds call. = FALSE to stop(). |
| NEWS.md | Adds a NEWS entry noting linting issue resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
79
to
+83
| "Offspring distribution must return integers" = | ||
| !all(possible_new_offspring %% 1 > 0) | ||
| ) | ||
|
|
||
| return(possible_new_offspring) | ||
| possible_new_offspring |
Comment on lines
+120
to
+123
| vapply( | ||
| x, rborel, | ||
| n = 1, censor_at = censor_at, FUN.VALUE = numeric(1) | ||
| )) | ||
| ) |
Remove redundant explicit return() calls, add call. = FALSE to stop() messages, replace constant-string sprintf() calls, avoid re-using the exported stats::dist symbol, use sample.int() and drop single-call pipes in vignettes.
jamesmbaazam
force-pushed
the
fix-linting-issues
branch
from
July 9, 2026 12:18
6f3db30 to
a1c9968
Compare
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.
Summary
All open PRs were failing the
lint-changed-filesCI check because of pre-existing linting issues onmain. Since that workflow only lints the files changed by each PR, the failures surfaced across different PRs depending on which files they touched. This PR resolves every genuine{lintr}issue in the package source and vignettes in one place so that, once merged, the other branches pass linting after rebasing ontomain.Issues addressed
Detected with
lintr::lint_package()(using the repo's.lintrconfig with theetdevandcyclocomppackages):return_linter(28) — removed redundant explicitreturn()calls inR/borel.R,R/helpers.R,R/simulate.R,R/stat_likelihoods.R,R/utils.Rand the vignettes, using implicit return instead.condition_call_linter(5) — addedcall. = FALSEtostop()calls inR/borel.R,R/helpers.RandR/stat_likelihoods.R.sprintf_linter(2) — replaced constant-stringsprintf()calls with plain strings inR/epichains.R.object_overwrite_linter(1) — renamed the localdistvariable (which shadowed the exportedstats::dist) tosimulated_statsinR/stat_likelihoods.R.sample_int_linter(4) — usedsample.int(10, ...)instead ofsample(1:10, ...)invignettes/epichains.Rmd.one_call_pipe_linter(2) — removed single-call%>%pipes invignettes/projecting_incidence.Rmd.The remaining lints reported locally (
object_usage_linter/missing_package_linterforepicontacts,truncdist, etc.) are environment-only false positives that clear on CI where those packages are installed.Verification
lintr::lint_package()reports 0 genuine lints after the changes.testthat::test_local()).Checklist