-
Notifications
You must be signed in to change notification settings - Fork 372
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
drift_lint package #3224
drift_lint package #3224
Conversation
🚀 Deployed on https://deploy-preview-3224--moor.netlify.app |
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.
How does custom_lint
find plugins? I would prefer these to be part of drift_dev
if possible instead of maintaining another package.
a74df20
to
b45e5a6
Compare
b45e5a6
to
50249f3
Compare
Great point. But for some reason I've opened an issue for this invertase/dart_custom_lint#275 |
@simolus3 |
This is really cool! Something we should consider is whether we want to find a way to report all lints As long as you have access to an analyzer context, it should be possible to create a drift analysis driver, run it on sources and then report issues found through there - I want to avoid duplicating logic for finding errors between lints and the build implementation. If this is not efficiently possible because the API exposed by |
This should be possible, that would be really cool! |
@simolus3 Is there a simple entry point where I can just pass in the AstNode of the I don't understand the generator code enough |
Essentially, this involves implementing Once you have a backend, you can use This will get much trickier when we're dealing with file invalidation and re-analyzing files after edits, but I suspect just setting this all up is also pretty tough. The backend infrastructure is essentially meant as as a thin abstraction over the build packages and a test setup, so let me know if you get stuck or if there's anything I should look at. |
How cpu intensive is running all that? |
Yeah that's what I'm worried about as well - I suspect it's not too bad because the analyzer itself is running again either way, and on builds that's what's making up most of the time. Ideally we should have a way to do invalidation on a per-file basis, but it's not trivial because changes in imports trigger other files we have to analyze again and so on. Under the assumption that the analyzer is the most expensive thing, maybe running the entire drift analysis is fine at the beginning? If it turns out to be a problem, relatively cheap solutions are debouncing or introducing the existing cache we have for builds. |
Done! It seems to work, but we need to find a way to emit errors with custom descriptions. |
Dude, this is insanely cool! Opened a discussion here to see why we can't/shouldnt use dynamic errors |
Ok, we got an answer invertase/dart_custom_lint#277 (comment) Users won't be able to disable individual lints. Thanks simon, I'll take it from here |
Duh, it's using the offset of the error in SQL without regard for the actual .dart file. @simolus3 Any easy way to fix this? |
If it's a single string literal, we can add the offset of the string in the Dart file to the SQL error. If it's not, we'll have to highlight the entire region as a precaution. I'll look into this, this also affects the existing warnings in builds. Edit: Done in 7665813. |
After further review, it seems for disabling and enabling rules you need to create a single I'm just going to name this lint |
Fixed in invertase/dart_custom_lint#276 |
1548a40
to
83cbb1d
Compare
createReturning
with ignore mode