-
Notifications
You must be signed in to change notification settings - Fork 1.7k
what lints to enable in the linter codebase #57737
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
Thanks for opening this issue! I think it's a very good topic for discussion, and this is a good place to discuss it. What follows is my personal opinion, and not necessarily that of the Dart team (or anyone else). It's intended to promote discussion, not to shut it down, so I hope it comes across correctly.
I actually think that's backward. I do not believe that any project should enable a lint because there isn't a stated reason not to. I think, rather, that a project should only enable those lints for which there is a stated reason for it to be enabled. And I don't believe that the linter package should be required to dogfood lints. It should be managed like any other package and only enable those rules that bring value to the developers. (Where "value" and "developers" are intentionally poorly defined terms.) I do not object to enabling additional lints, but I think we need to carefully consider the value that each one brings and only enable the ones that unequivocally add value. (And I think we should periodically re-evaluate previously enabled lints to see whether they still meet that criteria.) |
Echoing @bwilkerson I think we should be thoughtful about what value is being added by any proposed new analyses, being mindful of the vagueness of "value" too. Moving forward, I'd suggest maybe we take on proposals one at a time and weigh merits and implications in a dedicated tracking issue. (I'm also of the opinion that we might consider disabling some too and in that case we might follow the same process.) |
Big 👍to @bwilkerson's answer. The reason there is a linter is to lint additional static analysis issues that aren't part of the language, meaning that any enabled lint on any project should add value (and be worth the overhead of the lint - including analysis/perf time, complying with the lint, possible false positives, etc). @pq:
One of the reasons I hope to see a "Dart Team Official" style guide lint set (/cc @davidmorgan) is to also squash some of these external discussions into a single discussion on what we want for our own (I realize there are some packages where having slightly different configuration might be valuable, but those should be the exceptions not the rules, ideally) |
I meant that there should be an explanation to know why it is commented out. In the current
👍
👍 the lints enforcing Dart Style Guide should all be enabled. |
Maybe the lints enforcing required guidelines (though even there it isn't clear that all of them add value), but not all of the lints enforcing optional guidelines unless we all agree that there's sufficient value to warrant the overhead. |
Emphatic +1. Just because there are knobs doesn't mean we should turn them all up to 11. 🤘 |
From a “outside of google” developer perspective, that is trying to get productive in Dart, the linter is useful, but it is also 100 extra decision a developer has to make. It would save a lot of peoples time, if the Dart team had some guidelines, in the sense of, “You should definitely enable the following lints”, and “You may also want to enable the following lints”. |
@kasperpeulen : you make a very good point and we've discussed it a lot. (See #57364 for example.) . Needless to say, I agree! |
I think the major reason this discussion keeps cropping up is that we don't actually have an agreed-upon set of lints internally at google. We're gradually building such a set--it takes discussion and experimentation for each one. I'm not sure how useful a work in progress is to the open source world. Internally, the people adding a lint are responsible for fixing it everywhere--but externally, each individual project owner will have to make fixes whenever we push a change. |
This would work fine if the rulesets would be versioned, then it could be managed by developers if they want to apply the latest changes. |
True. A secondary issue is that the set that makes sense for external projects may be different. For example, we decided not to enforce empty_statements because we already enforce use of dartfmt, so empty statements already stand out. I guess we can publish the reasoning, too, and people can go from there. FWIW here's the current list of enforced lints
--yes, it's pretty short--work in progress! |
... or instead of versioning probably better #57730 |
There’s been a lot of varied discussion in this issue, and most has been resolved or is being discussed elsewhere.
Thanks all! |
There are the following 45 lints that are not enabled in
analysis_options.yaml
.Some are not compatible between each other. But a lot of them could be enable to improve the code (and dogfooding our lints).
Those that are commented out should have an explanation to know why.
The text was updated successfully, but these errors were encountered: