Skip to content

Commit dc7a612

Browse files
Revert "lint(text=) finds local settings again"
This reverts commit b548c78.
1 parent b548c78 commit dc7a612

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
## Bug fixes
1717

1818
* `Lint()`, and thus all linters, ensures that the returned object's `message` attribute is consistently a simple character string (and not, for example, an object of class `"glue"`; #2740, @MichaelChirico).
19-
* Files with encoding inferred from settings read more robustly under `lint(parse_settings = TRUE)` (#2803, @MichaelChirico). Thanks also to @bastistician for detecting a regression caused by the initial change for users of Emacs (#2847).
19+
* Files with encoding inferred from settings read more robustly under `lint(parse_settings = TRUE)` (#2803, @MichaelChirico).
2020

2121
## Changes to default linters
2222

R/lint.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ lint <- function(filename, linters = NULL, ..., cache = FALSE, parse_settings =
4545

4646
needs_tempfile <- missing(filename) || re_matches(filename, rex(newline))
4747
inline_data <- !is.null(text) || needs_tempfile
48+
parse_settings <- !inline_data && isTRUE(parse_settings)
4849

49-
if (isTRUE(parse_settings)) {
50+
if (parse_settings) {
5051
read_settings(filename)
5152
on.exit(reset_settings(), add = TRUE)
5253
}

R/settings.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
read_settings <- function(filename, call = parent.frame()) {
6666
reset_settings()
6767

68-
if (missing(filename)) filename <- "./any_local_file"
6968
config_file <- find_config(filename)
7069
default_encoding <- find_default_encoding(filename)
7170
if (!is.null(default_encoding)) {

tests/testthat/test-lint.R

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,3 @@ test_that("Linter() input is validated", {
233233
test_that("typo in argument name gives helpful error", {
234234
expect_error(lint("xxx", litners = identity), "Found unknown arguments in `...`: `litners`")
235235
})
236-
237-
test_that("settings are picked up under lint(text=)", {
238-
.lintr <- withr::local_tempfile(lines = "linters: list(assignment_linter())")
239-
withr::local_options(lintr.linter_file = .lintr)
240-
241-
# lint '=', but not the operator spacing
242-
expect_length(lint(text = "a=1"), 1L)
243-
})

0 commit comments

Comments
 (0)