-
Notifications
You must be signed in to change notification settings - Fork 4
Bug 149 #154
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #154 +/- ##
==========================================
+ Coverage 96.92% 97.01% +0.08%
==========================================
Files 24 25 +1
Lines 1172 1207 +35
==========================================
+ Hits 1136 1171 +35
Misses 36 36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment was marked as resolved.
This comment was marked as resolved.
radbasa
left a comment
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.
The three-deep loop can/will be difficult to maintain and debug. As single XPath query or a series of XPath queries can be tested manually using a XPath query utility.
| .Rproj.user | ||
| docs | ||
| inst/doc | ||
| box.linters.Rproj |
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.
Remove. Don't gitignore Rproj file.
| for (call_node in box_use_calls) { | ||
| # Get all arguments (import specifications) | ||
| args <- xml2::xml_find_all(call_node, "./expr[position() > 1]") | ||
|
|
||
| # Process each argument | ||
| for (arg in args) { | ||
| # Handle alias assignments (like tbl = tibble) | ||
| target_nodes <- xml2::xml_find_all(arg, ".//node()") | ||
|
|
||
| #' Extract components before [ bracket | ||
| import_parts <- extract_import_parts(target_nodes) | ||
|
|
||
| # Combine parts to form full import specifier | ||
| import_text <- paste(import_parts, collapse = "") | ||
|
|
||
| # Store the import text and XML node | ||
| all_imports <- append(all_imports, list(list(text = import_text, node = arg))) | ||
| } | ||
| } |
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.
Performance concern.
This is a three-deep nested loop with multiple xml searches which themselves are loops:
for
xml_find_all()
for
xml_find_all()
for # extract_import_parts()
O(n^3)
| return( | ||
| lintr::Linter(function(source_expression) { | ||
| return(list()) | ||
| list() |
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.
Don't change. This is addressed in PR #158
Issue #149
Duplicates on import should be linted.
Description
box_repeated_calls_linterthat detects repetitions even when on differentbox::usecalls;tests/testthat/test-box_repeated_calls_linter.R;box_repeated_calls_lintertorhino_default_linters;Definition of Done
R CMD check, linter, unit tests, spelling)..Rdfiles withroxygen2::roxygenise())