Skip to content

Commit

Permalink
Do not error with '<% %>' constructs
Browse files Browse the repository at this point in the history
Fixes #185
  • Loading branch information
jimhester committed Nov 10, 2016
1 parent e275050 commit 72f1985
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# lintr 1.0.0.9000 #
* Do not error with '<% %>' constructs (#185).
* Allow closing parenthesis or comma after closing curly brace (#167, @Enchufa2)
* Support checkstyle XML output (#156, @joshkgold)
* seq_linter, finds `1:length(...)` (and similar) expressions (#155, @gaborcsardi)
Expand Down
2 changes: 1 addition & 1 deletion R/extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extract_r_source <- function(filename, lines) {

pattern <- get_knitr_pattern(filename, lines)
if (is.null(pattern)) {
if (is.null(pattern$chunk.begin) || is.null(pattern$chunk.end)) {
return(lines)
}

Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-knitr_formats.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,12 @@ test_that("it handles asciidoc", {
default_linters
)
})

test_that("it does _not_ handle brew", {
expect_lint("'<% a %>'\n",
checks = list(
rex("Only use double-quotes."),
rex("Trailing blank lines are superfluous.")
),
default_linters)
})

0 comments on commit 72f1985

Please sign in to comment.