-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Flutter analyze watch improvements #11143
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
Flutter analyze watch improvements #11143
Conversation
yjbanov
left a comment
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.
LGTM
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.
nit: @Hixie is trying to remove usages of ++ in our code, replacing them with += 1.
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.
Fixed.
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 is a personal preference, but I think it's easier to reason about code when there are fewer mutations. Here instead of mutating the errors list, and therefore making the logic sensitive to the order in which operations happen, we could instead create new lists of errors whose names describe what's in the list, e.g.:
bool isMissingDocError(AnalysisError error) => error.code == 'public_member_api_docs';
final List<AnalysisError> allErrors = ...;
final int membersMissingDocumentation = allErrors.where(isMissingDocError).length;
final int detailedErrors = allErrors.where((e) => !isMissingDocError(e)).toList()..sort();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 modified the code to create a separate detailedErrors list as you suggested.
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.
Extraneous --watch
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.
Removed.
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.
nit: spaces around the named 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.
Fixed.
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.
maybe instead of special-casing the flutter repo like this in the server, we should just give a "--dartdocs" option to the analyzer? Or a command-line option to enable/disable specific lints?
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.
Several times Brian and I have discussed the best approach here. Our current top prospect is to add support for linter summaries in analysis_options.yaml, but that will take a while. This command line flag is intended to be very specific for your needs until the more general purpose mechanism is available.
|
Tests? |
…alyzeContinuously
c6bc201 to
536ac8f
Compare
|
Test added. |
|
@Hixie I think that I have addressed all comments. PLMK if there are additional issues or whether I should proceed. Thanks! |
|
This seems to have broken the tree. |
|
I noticed that earlier and it looked like a flake (see below). |
|
Travis is now happy, but AppVeyor can't download the Dart SDK. |
|
Looks like you just got unlucky and checked in at the same time other failures happened. |
|
Unfortunately, it appears this did break analyzing. :-| With the commit before this one, if I edit |
This reverts commit e13e780. Turns out that with this patch, we aren't actually catching all errors. For example, `flutter analyze --flutter-repo --watch` didn't report errors in `dev/devicelab/test/adb_test.dart`.
|
Since this breaks development I suggest we revert this until we've found the cause (and added a test to make sure we don't regress it!): #11328 |
|
Sorry about that. Will investigate. |
This improves
flutter analyze --watchto report the number of public members missing dartdoc similar toflutter analyze. Incremental progress on #10721The other half of this has landed in the Dart SDK, so this functionality will be a no-op until the Dart SDK has been rolled.