Skip to content

Commit 618f3dc

Browse files
Merge remote-tracking branch 'origin/cyclocomp-check-time' into cyclocomp-check-time
2 parents d3313c0 + 9d753c0 commit 618f3dc

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

R/assignment_linter.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,5 +195,3 @@ assignment_linter <- function(operator = c("<-", "<<-"),
195195
lints
196196
})
197197
}
198-
199-
drop_or_add <- function(x, y, add) (if (add) union else setdiff)(x, y)

R/extract.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ get_knitr_pattern <- function(filename, lines) {
5151
("knitr" %:::% "detect_pattern")(lines, tolower(("knitr" %:::% "file_ext")(filename))),
5252
warning = function(cond) {
5353
if (!grepl("invalid UTF-8", conditionMessage(cond), fixed = TRUE)) {
54-
cli_warn(cond)
54+
cli_warn(cond) # nocov. No known way to reach here.
5555
}
5656
invokeRestart("muffleWarning")
5757
}

R/get_source_expressions.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,12 @@ lint_parse_error_r43 <- function(e, source_expression) {
204204
line_number <- line_number - 1L
205205
}
206206

207+
# Safely handle invalid location info
207208
if (line_number < 1L || line_number > length(source_expression$lines)) {
208-
# Safely handle invalid location info
209+
# nocov start
209210
line_number <- 1L
210211
column <- 1L
212+
# nocov end
211213
}
212214

213215
line <- fixup_line(source_expression$lines[[line_number]])

R/path_utils.R

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,7 @@ is_valid_long_path <- function(path, lax = FALSE) {
106106
}
107107

108108

109-
split_paths <- function(path, sep = "/|\\\\") {
110-
if (!is.character(path)) {
111-
cli_abort("Argument {.arg path} should be a {.cls character} vector.")
112-
}
113-
if (!is.character(sep) || length(sep) != 1L || !nzchar(sep)) {
114-
cli_abort("Argument {.arg sep} should be a non-empty regular expression character string.")
115-
}
116-
Map(split_path, strsplit(path, sep), substr(path, 1L, 1L))
117-
}
109+
split_paths <- function(path) Map(split_path, strsplit(path, "/|\\\\"), substr(path, 1L, 1L))
118110

119111
split_path <- function(dirs, prefix) {
120112
# add root dir if needed

R/zzz.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ default_undesirable_operators <- all_undesirable_operators[names(all_undesirable
224224
NULL
225225
)]
226226

227+
# nocov start
227228
rd_undesirable_operators <- function() {
228229
op_link_map <- c(
229230
`:::` = "\\link[base:ns-dblcolon]{:::}",
@@ -244,6 +245,7 @@ rd_undesirable_operators <- function() {
244245
"}"
245246
)
246247
}
248+
# nocov end
247249

248250
#' Default lintr settings
249251
#'

tests/testthat/test-object_overwrite_linter.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,7 @@ test_that("lints vectorize", {
175175
object_overwrite_linter(packages = c("stats", "base"), allow_names = "sum")
176176
)
177177
})
178+
179+
test_that("Validation works", {
180+
expect_error(object_overwrite_linter(packages = "invalid_"), "required, but not available", fixed = TRUE)
181+
})

0 commit comments

Comments
 (0)