Skip to content

Commit

Permalink
add ']' to the whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
saurfang committed Dec 29, 2015
1 parent abda27f commit 62eadcb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/spaces_left_parentheses_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spaces_left_parentheses_linter <- function(source_file) {
last_type <- tail(terminal_tokens_before, n = 1)

is_function <- length(last_type) %!=% 0L &&
(last_type %in% c("SYMBOL_FUNCTION_CALL", "FUNCTION", "'}'", "')'"))
(last_type %in% c("SYMBOL_FUNCTION_CALL", "FUNCTION", "'}'", "')'", "']'"))

if (!is_function) {

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-spaces_left_parentheses_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ test_that("returns the correct linting", {

expect_lint("function(){function(){}}()()", NULL, spaces_left_parentheses_linter)

expect_lint("c(function(){})[1]()", NULL, spaces_left_parentheses_linter)

expect_lint("((1 + 1))",
rex("Place a space before left parenthesis, except in a function call."),
spaces_left_parentheses_linter)
Expand Down

0 comments on commit 62eadcb

Please sign in to comment.