-
Notifications
You must be signed in to change notification settings - Fork 1.7k
capture lint<=>automation correspondences (for scoring) #57879
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
Comments
Thinking over this a little more, I think this is less about fix vs. assist but rather whether a remedy can be automatically applied by a tool (and note that the formatter is another one). With that in mind we might have a table like this:
|
@bwilkerson: I wonder how you feel about adding some breadcrumbs to the analyzer sources to capture correspondences between assists and lints in-line. For example, the assist added by Future<List<Assist>> compute() async {
...
await _addProposal_assignToLocalVariable();
await _addProposal_convertClassToMixin();
// lint: prefer_finals
await _addProposal_convertIntoFinalField();
...
} I'm guessing a string would be enough though we might consider an annotation if we want to protect against accidentally breaking the expected format. ( Just spitballing so any thoughts appreciated! |
That's not a bad idea, but it does have the drawback that other tools can't reasonably use the information. I had a slightly different idea earlier this morning. Server defines a class named Capturing the information in the data structure would not only serve the immediate goal, but would then allow us to pass this information to server's clients so that they could use this to present "fixes" for lint violations in places where assists would otherwise not be appropriate (such as the "Dart Analysis" view in IntelliJ). |
Oh! Now that's so much better. I love that it could solve the "align assists and fixes" problem too. I'm sold! |
@bwilkerson: given this datastructure would live in server, are you imagining we'd parse it out of the source the way we currently do for fixes? FWIW: here's where we do that: Ideally I could add a |
I imagine we could do something similar (though personally I would have used the parser to create an AST and then visited it :-). If we make the list of lint rule names a named parameter for the |
Food for thought: https://dart-review.googlesource.com/c/sdk/+/91857
Oh. Now that's a great idea! If it makes sense to tackle assists that way, I'll update the fix scoring at the same time. Thanks! |
Background: https://github.com/dart-lang/linter/issues/1375. Provisional API. Open for discussion! Change-Id: I2a1608d748dc0f807b953bd2bc94b24e276c8286 Reviewed-on: https://dart-review.googlesource.com/c/91857 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Phil Quitslund <[email protected]>
This is now tracked in https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml for lints and also surfaced on dart.dev/lints. |
Follow-up from #57878, we should identify all lints that have server quick assists that can act as "fixes" so we can update the scorecard.
/cc @bwilkerson
The text was updated successfully, but these errors were encountered: