-
Notifications
You must be signed in to change notification settings - Fork 4
Fix [STYLE_bug] When styling does not find a box::use, all lines are converted into NA #134 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix [STYLE_bug] When styling does not find a box::use, all lines are converted into NA #134 #155
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #155 +/- ##
=======================================
Coverage 96.92% 96.93%
=======================================
Files 24 24
Lines 1172 1173 +1
=======================================
+ Hits 1136 1137 +1
Misses 36 36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…oxuse-all-lines-are-converted-into-na
| find_source_lines_to_retain <- function(source_file_lines, box_lines) { | ||
| source_lines <- seq(1, length(source_file_lines)) | ||
| empty_source_lines <- which(grepl(pattern = "^[:space:]*$", source_file_lines)) | ||
| empty_source_lines <- which(grepl(pattern = "^[[:space:]]*$", source_file_lines)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! @vituri
| non_box_lines <- source_lines[!source_lines %in% box_lines$all] | ||
| end_of_box_calls <- ifelse( | ||
| empty_source_lines[empty_source_lines > box_lines$max][1] == box_lines$max + 1, | ||
| !rlang::is_empty(empty_source_lines) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! @vituri
Have you read the Contributing Guidelines?
Issue #134
Description
The problem was in
find_source_lines_to_retain, which that calculates which lines are before and after the box::use calls:This line will be integer(0) when there are no empty lines:
so I changed
end_of_box_callsto this:and add 2 tests to cover this case.
Definition of Done
R CMD check, linter, unit tests, spelling)..Rdfiles withroxygen2::roxygenise())