Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed May 11, 2024
1 parent 2df29fb commit e0e2ed4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions R/rules-line-breaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ set_line_break_after_ggplot2_plus <- function(pd) {
}


remove_empty_line_after_opening_braces <- function(pd) {
remove_empty_lines_after_opening_braces <- function(pd) {
opening_braces <- c("'('", "'['", "LBB")
paren_after <- pd$token %in% opening_braces
if (!any(paren_after)) {
Expand All @@ -431,7 +431,7 @@ remove_empty_line_after_opening_braces <- function(pd) {
pd
}

remove_empty_line_before_closing_braces <- function(pd) {
remove_empty_lines_before_closing_braces <- function(pd) {
closing_braces <- c("')'", "']'", "RBB")
paren_before <- pd$token %in% closing_braces
if (!any(paren_before)) {
Expand Down
11 changes: 6 additions & 5 deletions R/rules-spaces.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ remove_space_after_unary_pm_nested <- function(pd) {
}

remove_space_before_opening_paren <- function(pd_flat) {
paren_after <- pd_flat$token %in% c("'('", "'['", "LBB")
opening_braces <- c("'('", "'['", "LBB")
paren_after <- pd_flat$token %in% opening_braces
if (!any(paren_after)) {
return(pd_flat)
}
Expand All @@ -141,8 +142,8 @@ remove_space_before_opening_paren <- function(pd_flat) {
}

remove_space_after_opening_paren <- function(pd_flat) {
braces <- c("'('", "'['", "LBB")
paren_after <- pd_flat$token %in% braces
opening_braces <- c("'('", "'['", "LBB")
paren_after <- pd_flat$token %in% opening_braces
if (!any(paren_after)) {
return(pd_flat)
}
Expand All @@ -151,8 +152,8 @@ remove_space_after_opening_paren <- function(pd_flat) {
}

remove_space_before_closing_paren <- function(pd_flat) {
braces <- c("')'", "']'")
paren_after <- pd_flat$token %in% braces
closing_braces <- c("')'", "']'")
paren_after <- pd_flat$token %in% closing_braces
if (!any(paren_after)) {
return(pd_flat)
}
Expand Down
4 changes: 2 additions & 2 deletions R/style-guides.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ tidyverse_style <- function(scope = "tokens",
set_line_break_after_ggplot2_plus = if (strict) {
set_line_break_after_ggplot2_plus
},
remove_empty_line_after_opening_braces = remove_empty_line_after_opening_braces,
remove_empty_line_before_closing_braces = remove_empty_line_before_closing_braces
remove_empty_lines_after_opening_braces = remove_empty_lines_after_opening_braces,
remove_empty_lines_before_closing_braces = remove_empty_lines_before_closing_braces
)
}

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-transformers-drop.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ test_that("tidyverse transformers are correctly dropped", {
"set_line_break_before_closing_call",
"remove_line_break_in_fun_call",
"set_line_break_after_ggplot2_plus",
"remove_empty_line_after_opening_braces",
"remove_empty_line_before_closing_braces"
"remove_empty_lines_after_opening_braces",
"remove_empty_lines_before_closing_braces"
)
expect_setequal(names(t_fun$line_break), names_line_break)

Expand Down

0 comments on commit e0e2ed4

Please sign in to comment.