Skip to content

Commit

Permalink
Merge branch 'main' into 1797_deprecated_unneeded_cat
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil authored Dec 18, 2022
2 parents 0f2474a + f253094 commit ed4957c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
4 changes: 2 additions & 2 deletions R/deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ lintr_deprecated <- function(old, new = NULL, version = NULL,
type = "Function") {
msg <- c(
c(type, " ", old, " was deprecated"),
if (length(version)) {
if (length(version) > 0L) {
c(" in lintr version ", version)
},
". ",
if (length(new)) {
if (length(new) > 0L) {
c("Use ", new, " instead.")
}
)
Expand Down
21 changes: 0 additions & 21 deletions R/get_source_expressions.R
Original file line number Diff line number Diff line change
Expand Up @@ -535,27 +535,6 @@ get_newline_locs <- function(x) {
)
}

find_line_fun <- function(content, newline_locs) {
function(line_number) {
warning(
"find_line is deprecated and will soon be removed. ",
"XPath logic and xml_nodes_to_lints() are usually preferable"
)
which(newline_locs >= line_number)[1L] - 1L
}
}

find_column_fun <- function(content, newline_locs) {
function(line_number) {
warning(
"find_column is deprecated and will soon be removed. ",
"XPath logic and xml_nodes_to_lints() are usually preferable"
)
matched_line_number <- which(newline_locs >= line_number)[1L] - 1L
line_number - newline_locs[matched_line_number]
}
}

# Fix column numbers when there are tabs
# getParseData() counts 1 tab as a variable number of spaces instead of one:
# https://github.com/wch/r-source/blame/e7401b68ab0e032fce3e376aaca9a5431619b2b4/src/main/gram.y#L512
Expand Down
19 changes: 19 additions & 0 deletions R/lintr-deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,22 @@ unneeded_concatenation_linter <- function(allow_single_expression = TRUE) {
)
unnecessary_concatenation_linter(allow_single_expression = allow_single_expression)
}

#' @keywords internal
#' @noRd
find_line_fun <- function(content, newline_locs) {
function(line_number) {
lintr_deprecated("find_line_fun", new = "XPath logic and xml_nodes_to_lints()", version = "3.0.0")
which(newline_locs >= line_number)[1L] - 1L
}
}

#' @keywords internal
#' @noRd
find_column_fun <- function(content, newline_locs) {
function(line_number) {
lintr_deprecated("find_column_fun", new = "XPath logic and xml_nodes_to_lints()", version = "3.0.0")
matched_line_number <- which(newline_locs >= line_number)[1L] - 1L
line_number - newline_locs[matched_line_number]
}
}

0 comments on commit ed4957c

Please sign in to comment.