Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
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 @@ -176,3 +176,22 @@ semicolon_terminator_linter <- function(semicolon = c("compound", "trailing")) {
allow_trailing <- !"trailing" %in% semicolon
semicolon_linter(allow_compound, allow_trailing)
}

#' @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")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is version correct?

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]
}
}