Skip to content

Commit

Permalink
Update indentation_linter.R
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Dec 4, 2024
1 parent f382912 commit 246207e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/indentation_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ indentation_linter <- function(indent = 2L, hanging_indent_style = c("tidy", "al
}

# Only lint non-empty lines if the indentation level doesn't match.
# TODO: remove styler ignore directives once tidyverse/style/issues/197 is resolved
# styler: off
bad_lines <- which(indent_levels != expected_indent_levels &
nzchar(trimws(source_expression$file_lines)) &
!in_str_const)
nzchar(trimws(source_expression$file_lines)) &
!in_str_const)
# styler: on
if (length(bad_lines) > 0L) {
# Suppress consecutive lints with the same indentation difference, to not generate an excessive number of lints
is_consecutive_lint <- c(FALSE, diff(bad_lines) == 1L)
Expand Down

0 comments on commit 246207e

Please sign in to comment.