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

Fix some lints #2048

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ get_objs_from_dots <- function(.dots) {
}

is_name <- vapply(.dots, is.symbol, logical(1))
if (any(!is_name)) {
if (!all(is_name)) {
ui_abort("Can only save existing named objects.")
}

Expand Down
2 changes: 1 addition & 1 deletion R/proj-desc.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ proj_desc_field_update <- function(key, value, overwrite = TRUE, append = FALSE)
return(invisible())
}

if (!overwrite && length(old > 0) && any(old != "")) {
if (!overwrite && length(old) > 0 && any(old != "")) {
ui_abort("
{.field {key}} has a different value in DESCRIPTION.
Use {.code overwrite = TRUE} to overwrite.")
Expand Down
2 changes: 1 addition & 1 deletion R/use_standalone.R
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ as_version_info_row <- function(field, error_call = caller_env()) {

ver <- strsplit(ver, " ")[[1]]

if (!is_character(ver, n = 2) || any(is.na(ver)) || !all(nzchar(ver))) {
if (!is_character(ver, n = 2) || anyNA(ver) || !all(nzchar(ver))) {
cli::cli_abort(
c(
"Can't parse version `{field}` in `imports:` field.",
Expand Down
2 changes: 1 addition & 1 deletion R/utils-git.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

# translate from "usethis" terminology to "git" terminology
where_from_scope <- function(scope = c("user", "project")) {
scope = match.arg(scope)
scope <- match.arg(scope)

Check warning on line 86 in R/utils-git.R

View check run for this annotation

Codecov / codecov/patch

R/utils-git.R#L86

Added line #L86 was not covered by tests

where_scope <- c(user = "global", project = "de_facto")

Expand Down
2 changes: 1 addition & 1 deletion R/utils-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ github_remotes <- function(these = c("origin", "upstream"),
# 1. Did we call the GitHub API? Means we know `is_fork` and the parent repo.
# 2. If so, did we call it with auth? Means we know if we can push.
grl$github_got <- map_lgl(repo_info, ~ length(.x) > 0)
if (isTRUE(github_get) && any(!grl$github_got)) {
if (isTRUE(github_get) && !all(grl$github_got)) {
oops <- which(!grl$github_got)
oops_remotes <- grl$remote[oops]
oops_hosts <- unique(grl$host[oops])
Expand Down
2 changes: 1 addition & 1 deletion tests/manual/manual-use-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ expect_match(desc::desc_get_field("BugReports"), BugReports)

# remove the GitHub links
desc::desc_del(c("BugReports", "URL"))
expect_true(all(!desc::desc_has_fields(c("BugReports", "URL"))))
expect_true(!any(desc::desc_has_fields(c("BugReports", "URL"))))

# restore the GitHub links
# should see a warning that `host` is deprecated and ignored
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-proj.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ test_that("with_project() runs code in temp proj, restores (lack of) proj", {
)

proj_set_(NULL)
expect_identical(proj_get_(), NULL)
expect_null(proj_get_())

res <- with_project(path = temp_proj, proj_get_())

expect_identical(res, temp_proj)
expect_identical(proj_get_(), NULL)
expect_null(proj_get_())
})

test_that("with_project() runs code in temp proj, restores original proj", {
Expand Down
Loading