Repository navigation
spaces_left_parentheses_linter uses XML tree - #724
Conversation
|
Yes I can do that. |
|
Hi. Conversely, the lints found in main but not #724:
Here's some examples |
|
|
|
Thanks! As I suspected The repeated calls thing is the main work ahead. Will revisit. |
|
Much more confident in the current approach so removing WIP. Running some comparisons now to see if there are some more edge cases to consider. |
|
Did you see the lint annotations in unchanged files? |
|
Seems we'll need to use the affirmative ( |
|
Still missing a ton of branches caught on current HEAD. Mostly because of nested arithmetic expressions; fixing that now. HEAD might generate lints for files that don't parse where this branch doesn't; I think behavior in error cases doesn't need to be consistent. The number of lints caught here and not on main is very small. All seem to be generated by files in the For some reason HEAD is not generating a lint on this line: |
|
There's one case that is pretty tough to fix with an XML approach: That's because those are split into different expressions and we're using the expression-level approach here for cache-friendliness. It's pretty rare (in 500 tested packages, it happened 3 times) -- WDYT? |
I would favour correctness over cache-friendlyness. |
OK, done; it's actually pretty easy to just write a targeted version of the logic for the global case. |
|
Consolidated all of the apparent false positives caught by this branch in #780. Purging those from the discussion above to provide more focus. |
|
Not sure what's going on with coverage... I had to add the branch in 80a0139 since tests were failing. Tests are passing now but codecov says that branch is missed? Not sure how that can be.
|
| }) | ||
|
|
||
| if (is.null(source_file$xml_parsed_content)) { | ||
| if (is.null(source_file$full_xml_parsed_content)) return(list()) |
There was a problem hiding this comment.
This if might be unreachable, either xml_parsed_content or full_xml_parsed_content is filled (unless maybe parsing fails, not sure about that).
There was a problem hiding this comment.
in fact it was this test that caused was triggering an error:
Hence including this in 80a0139 -- maybe that same error doesn't show up on the codecov platform for some reason?
|
Maybe we should unit test |
Are you unable to just merge as is? I think it's fine to occasionally make a one-line backslide like this now that we're >99%, given that we look at the issue and decide it's OK. |
|
Ran on 1000 packages at current commit in this branch -- all that are left are differences in lints spotted in the presence of syntax errors, and the false positives mentioned in #780 -- good to merge IMO! Here is a file of the ~1300 such lints found at HEAD but not in this PR (out of ~125K lints total on HEAD): You can apply this filter to skip the false positives IINM: The rest (23 more) are all syntax errors AFAICT |
Merging is blocked by codecov. |
|
Just confirmed for sure that branch is being hit locally for me. Just pushed a test commit with tracing, let's see what comes out in the logs. |
|
Didn't really see anything in the trace log 🧐 Anyway, added a |
|
Still couldn't hit the required coverage... #nocov'd that line for now to just move on. |
| # for coverage | ||
| test_that("xml_nodes_to_lint handles >1-line nodes correctly", { | ||
| xml <- xml2::read_xml('<x line1="1" col1="1" line2="2" col2="10" start="8" end="25"></x>') | ||
| source_file = list(filename = "test", lines = c(`1` = "abcdefg", `2` = "hijklmnopq")) |
There was a problem hiding this comment.
thanks! is there a place to see these without checking out the Changes tab (which I don't always do)...
maybe I should write a precommit hook for this
There was a problem hiding this comment.
You can manually look at the action logs, e.g. here
Other than that, locally running devtools::load_all(); lint_package() is probably the most convenient way.
|
Just realized we never included a NEWS item here :\ would have been useful. e.g. this update to the linter fixed some false positives, e.g. something we see a lot in Would get linted because From the discussion above it seems there were a few such edge cases that are now handled "more correctly" but I'm forgetting the specifics... |
Closes #628 , Closes #780