Skip to content

Commit

Permalink
Fix some lints
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Aug 22, 2024
1 parent a225a21 commit 2e99921
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
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 @@ git_user_get <- function(where = c("de_facto", "local", "global")) {

# 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
2 changes: 1 addition & 1 deletion tests/testthat/test-utils-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_that("parse_github_remotes() works, on named list or named character", {
bitbucket2 = "[email protected]:OWNER/REPO.git"
)
parsed <- parse_github_remotes(urls)
expect_equal(parsed$name, names(urls))
expect_named(urls, parsed$name)
expect_equal(unique(parsed$repo_owner), "OWNER")
expect_equal(
parsed$host,
Expand Down

0 comments on commit 2e99921

Please sign in to comment.