-
Notifications
You must be signed in to change notification settings - Fork 7
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
add additional lints to dart_flutter_team_lints #167
Conversation
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthPackage publish validation ✔️Details
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. License Headers ✔️Details
All source files should start with a license header. Changelog Entry ❗Details
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Coverage
|
File | Coverage |
---|---|
pkgs/firehose/lib/firehose.dart | 💔 Not covered |
pkgs/firehose/lib/src/github.dart | 💚 10 % |
pkgs/firehose/lib/src/health/health.dart | 💔 Not covered |
pkgs/firehose/lib/src/repo.dart | 💚 87 % |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check
Here are the lint results from this repo:
So, 8 |
|
||
linter: | ||
rules: | ||
# consistency | ||
- avoid_empty_else | ||
- avoid_shadowing_type_parameters | ||
- avoid_types_as_parameter_names | ||
- avoid_unused_constructor_parameters |
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.
This one could lead to forced breaking API changes if a constructor parameter stops being used but is still passed by callers.
I don't know if it would ever occur that a constructor argument starts being ignored and it's not already a breaking behavior change, but I'm a little paranoid about lints that could suggest breaking API changes because an author applying a quick fix is less likely to consider impact on usages than an author manually changing arguments...
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.
Yes, people will feel the need to address these issues, and will assume that the lint is telling them the right thing to do.
@@ -35,8 +37,10 @@ linter: | |||
- lines_longer_than_80_chars | |||
- omit_local_variable_types | |||
- prefer_asserts_in_initializer_lists | |||
- prefer_const_constructors |
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.
@sigmundch - is there any risk of degrading IPL or any other negative impacts by making too many values const
in widely used packages?
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.
I don't have a strong opinion with this lint, but note that we do have it enabled in 22 of 29 sampled dart-lang packages, and flutter turns this lint on.
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.
Indeed, it moves initialization of each of those values to be done eagerly during the IPL as you noted (as opposed to being lazy or on-demand at the time you need it.). The question comes down to how many constants we are talking about. If it's just a handful of them, it's fine, but if all the sudden this will increase the total number of constants by 2x, that's more concerning.
cc @rakudrama, although he is about to be on PTO for a while.
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.
It will degrade IPL but a few small constants will not make much difference. It is really hard to give advice here since it depends a lot on the number and qualities of the constants. A few moderate sized class constants would be fine, unless one of their fields were initialized with, say, a gargantuan map.
I'd like to make dart2js be smarter about the impact of larger constants on IPL (e.g. dart-lang/sdk#32943) but I don't think it will ever be zero.
I would say go ahead since constant widgets, being identical each frame, help the flutter framework more efficiently detect parts of the widget tree that are invariant. It can translate to better frame rate.
|
||
# correctness | ||
- always_declare_return_types | ||
- avoid_catching_errors | ||
- avoid_dynamic_calls | ||
- await_only_futures | ||
- cancel_subscriptions |
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.
I don't think this lint is reliable enough - there are false positives.
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.
sgtm - will remove
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.
Updated to remove avoid_unused_constructor_parameters
and cancel_subscriptions
.
Note that I also added in conditional_uri_does_not_exist
- not in the original PR.
This adds 7 of the lints that we've commonly enabled on dart-lang packages; see #110 for the full list and counts from our repos.
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.