-
Notifications
You must be signed in to change notification settings - Fork 186
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
Include the expression ID in the Lint object #710
Comments
How would you define the expression ID for linters that don't operate on the expression level? |
NA is fine there right?
…On Fri, Jan 22, 2021, 9:18 AM AshesITR ***@***.***> wrote:
How would you define the expression ID for linters that don't operate on
the expression level?
e.g. line_length_linter or linters looking at indentation?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#710 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2BA5OZQIDLMSJJQP4UXPTS3GXNBANCNFSM4WOBQDUA>
.
|
WDYT about making the potential new data an optional argument to And maybe default it to NULL which I think is a more explicit way of missingness than NA... Code that wants to use the information should check for its presence on every What exactly is your use-case? Do you want to mass-transform code with a certain type of lint to an equivalent but lint-free alternative? |
I think it would have to be an argument to
Yep, I would handle that in the PR (or in a follow-up perhaps)
pretty much yes. |
I just noticed that the XPath based linters (our preferred way of doing stuff) seem to not contain expression IDs either, restricting the possible linters to only those using the parse_data df. |
Oh I thought they did have it. a shame that they don't... I will try and
file something with xmlparsedata then first.
…On Sun, Jan 31, 2021, 3:46 PM AshesITR ***@***.***> wrote:
I just noticed that the XPath based linters (our preferred way of doing
stuff) seem to not contain expression IDs either, restricting the possible
linters to only those using the parse_data df.
Given that's the case, do you really think we should add this feature?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#710 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2BA5KPUYFAVG5UN47EMMLS4XTUFANCNFSM4WOBQDUA>
.
|
Here's a random nodeset from testing the #583 PR.
Maybe we should remove the issue from the 3.0.0 milestone then? |
Is this feature still considered useful, despite most of our linters using XPath? |
Agree there's not much use for this at this point, especially given the technical blockers. |
I'm trying to use the lint output to go back to the file & make some edit around the lint.
Currently the
Lint
object contains the line (l1
) & column (c1
) number, but this is not sufficient:(l1, c1)
and, in general, "parse locally". For some purposes, a regex or simple stack-based approach (for matching delimiters) would be enough. Therefore it's better to work back to some form of parsed data (e.g. thexml_parse_data
tree, or thegetParseData
data.frame
).l1
andc1
might be shared by multiple nodes:Notice multiple
expr
nodes with(l1, c1) = (1, 5)
.ranges
isn't enough either because that's used for pretty printing. Usually (not always) there is different logic for how ranges is determined if the targetexpr
spans multiple lines, which makes it way more difficult (I don't think impossible? but at least requires way more knowledge about the linter's internals) to back out which row we are looking for exactly.A very simple (IINM) workaround to all of this is to include the row ID of the target node (e.g.
11
or5
at(1, 5)
above) in theLint
object.The fix is simple but I added a lot of context since I think this would require changes for downstreams writing custom linters. That said, IINM the older style of object would probably still work without issue for existing use cases.
Any other things to consider here?
The text was updated successfully, but these errors were encountered: