-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[meta] rationalize/align/document different lint rule sets #57873
Comments
It makes sense to me to change stagehand to build a project that imports from pedantic. It also makes sense to me that pana would be based on pedantic, but it might be the case that it makes sense for it to be a superset. I'm not familiar with the differences between the two rule sets. My personal preference would be for dartanalyzer to not enable any lints by default. Lints were always designed to be opt-in, but enabling some by default violates that contract. I agree that we're not going to change Flutter's lists of rules. |
It seems inconsistent to me to have stagehand and flutter produce new Dart packages that are not equally pedantic. |
For context, here's a breakdown of what rules are currently defined where.
|
Very nice way of comparing, thanks. I kind of wish it included 'pana', though. So, 'pedantic' defines 16 rules and 'flutter user' defines 28, but only 10 of those are in the intersection. Similarly, stagehand defines 7 rules and only 2 are in the intersection with 'pedantic'. The rule sets are farther apart than I had guessed. |
|
I'm fine with using pedantic for stagehand templates. |
💎 Assuming we can find consensus, dart-archive/stagehand#594 updates stagehand. If that sticks, we can update |
I don't see |
While we're at it, you helped me notice a bug in my table generator... Notice the sorting?
The Thanks for the catch! (EDIT: order fixed 👍) |
I don't think we should update Stagehand before we resolve the larger issue: Customers increasingly use Dart across multiple platforms and frameworks, and will no doubt be very confused if they try to move a few lines of code from one context to another and suddenly see different static errors. I suggest we collaborate with the Flutter team on getting to a single set of default rules for Dart libraries and apps, regardless of framework or platform. |
@mit-mit: here's a more targeted view for the purposes of that conversation. (cc @Hixie FYI.)
(95 lints w/o rulesets not shown) |
FYI @a14n |
Pedantic enables |
http://dart-lang.github.io/linter/lints/null_closures.html The |
Thanks @davidmorgan ! Sorry for the noise. |
@mit-mit I'm concerned by this comment, but perhaps I'm misunderstanding what you're saying. While I completely agree that there are some conditions that are not included in the specification that should be reported to all users (which for historic reasons we call "hints"), I believe that there is room for allowing users to choose to have some other conditions reported based on their personal preference (which we, and the larger industry, call "lints"). But this makes it sound like you're proposing that there should be a single list of lints that should be recommended to all users. If we accept the preference that it's OK to disagree about which lints to enable, then I don't see why it would be bad for us to have multiple example rule sets tailored to some common sets of preferences. We don't need to internally enforce all of the rules that Flutter recommends, nor do we need to limit Flutter users to only those rules we use internally.
(Minor nit: they aren't static errors, they're lints, which typically are represented differently to the user.) Nits aside, I don't think that's true at all. If I copy some code from an open source package and paste it into mine, and I have enabled a lint to help enforce a preferred style that the other package didn't enforce, and if I then get lints suggesting that I change the code, I think I'll understand exactly why I got that lint: because the original authors didn't enforce the same style that I do. |
Agreement here may be challenging; I think just reducing the number of disparate rules sets would be a worthwhile improvement. |
I think a good start would be agreeing on
1 Since 📟 paging @Hixie for a gut check... |
I expect we (Flutter) will want to control our rule set explicitly (we toggle rules on and off multiple times a month), and it's really valuable for us to have the complete list on our analysis options with explicit comments next to each one that we don't turn on explaining why, so it's not clear to me that this would be solving a problem that we have. As a user (and not with my Flutter hat on), I'd love to have a way to turn on all possible lints, and require that I opt-out of the ones I don't want. This is because I frequently find that some super-useful lint has existed for months without my knowing. |
Thanks @Hixie. Super helpful.
I should be clear that the problem this general issue is trying to address is less about framework authors and more about users who are understandably bewildered. I think the alignment around Your ask for a better awareness around new lints deserves it's own topic so I started one in #57885 👍. Cheers all for the thoughtful feedback! |
I added a few ideas for documentation in the main issue description but ideas are most welcome. @kwalrath: any thoughts here? Is there a single doc (existing, repurposed or new) that the various tools could point back to? |
I'm in the midst of updating Customize Static Analysis to talk about includes and pedantic. It wouldn't have a complete list of lints, though. What would you like to have on the page you point to? |
That's awesome @kwalrath!
Maybe just what you're doing already? Besides the mechanics of including options, something that establishes that there is a kernel set of rules that is shared by a number of our tools would be great. Thanks! |
I don't have a good sense of what our users want in this space. @InMatrix might. |
Follow up from: https://github.com/dart-lang/linter/issues/1365. Change-Id: Iaeef849406b191d99a84501884c3d34b37ccb59d Reviewed-on: https://dart-review.googlesource.com/c/91681 Commit-Queue: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Thanks for the thoughtful back and forth all. With @kwalrath's docs and the most recent updates to Cheers! 🍻 |
Rationalization
The Dart ecosystem has a number of "default" rulesets.
pana
package uses one that should mirror what is used bystagehand
but could consider another (for example, pedantic?)package:pedantic
describes google standard defaults, which are close but not quite to a subset of those in Effective Dartpackage:pedantic
lints dart-archive/stagehand#593)?dartanalyzer
tool uses yet another set of rules (What are the default lints enforced? #57872)Needless to say, this is VERY confusing. Ideally we could converge on one set of defaults with variants well documented.
Alignment
Concretely, I'd propose we converge on
package:pedantic
where possible. Specifically, I'd suggest defaults should be:stagehand
: pedantic (consider updating template to usepackage:pedantic
lints dart-archive/stagehand#593)pana
: pedantic (Consider using pedantic as a baseline for linting? pana#459)dartanalyzer
: none (NPE given invalid import #1376, Remove lint rule registry default list #35708)flutter
user: superset of(leave informal for now)pedantic
?Documentation
Having aligned as best we can, we'll want to document. Some thoughts for where:
analyzer
package README (shows in pub) PRlinter
generated rule docs/cc @bwilkerson @davidmorgan @kevmoo @mit-mit @stereotype441 @devoncarew @kwalrath
The text was updated successfully, but these errors were encountered: