Skip to content

Conversation

@danrubel
Copy link
Contributor

@danrubel danrubel commented Jul 10, 2017

This improves flutter analyze --watch to report the number of public members missing dartdoc similar to flutter analyze. Incremental progress on #10721

The 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.

@danrubel danrubel mentioned this pull request Jul 10, 2017
5 tasks
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

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();

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extraneous --watch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@Hixie
Copy link
Contributor

Hixie commented Jul 11, 2017

Tests?

@danrubel danrubel force-pushed the flutter-analyze-watch-improvements branch from c6bc201 to 536ac8f Compare July 14, 2017 16:23
@danrubel
Copy link
Contributor Author

Test added.

@danrubel
Copy link
Contributor Author

@Hixie I think that I have addressed all comments. PLMK if there are additional issues or whether I should proceed. Thanks!

@Hixie
Copy link
Contributor

Hixie commented Jul 19, 2017

LGTM

@danrubel danrubel merged commit e13e780 into flutter:master Jul 19, 2017
@Hixie
Copy link
Contributor

Hixie commented Jul 19, 2017

This seems to have broken the tree.

@danrubel
Copy link
Contributor Author

I noticed that earlier and it looked like a flake (see below).
I just restarted the job (which I should have done earlier) to see if that addresses the issue.

Traceback (most recent call last):
  File "/home/travis/google-cloud-sdk/platform/gsutil/gsutil", line 22, in <module>
    gsutil.RunMain()
  File "/home/travis/google-cloud-sdk/platform/gsutil/gsutil.py", line 113, in RunMain
    import gslib.__main__
  File "/home/travis/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 39, in <module>
    import boto
  File "/home/travis/google-cloud-sdk/platform/gsutil/third_party/boto/boto/__init__.py", line 1216, in <module>
    boto.plugin.load_plugins(config)
  File "/home/travis/google-cloud-sdk/platform/gsutil/third_party/boto/boto/plugin.py", line 93, in load_plugins
    _import_module(file)
  File "/home/travis/google-cloud-sdk/platform/gsutil/third_party/boto/boto/plugin.py", line 75, in _import_module
    return imp.load_module(name, file, filename, data)
  File "/usr/lib/python2.7/dist-packages/google_compute_engine/boto/compute_auth.py", line 19, in <module>
    from google_compute_engine import logger
ImportError: No module named google_compute_engine

@danrubel
Copy link
Contributor Author

Travis is now happy, but AppVeyor can't download the Dart SDK.

@Hixie
Copy link
Contributor

Hixie commented Jul 19, 2017

Looks like you just got unlucky and checked in at the same time other failures happened.

@Hixie
Copy link
Contributor

Hixie commented Jul 20, 2017

Unfortunately, it appears this did break analyzing. :-|

With the commit before this one, if I edit dev/devicelab/test/adb_test.dart to include an error, flutter --watch --flutter-repo catches it. At this commit, it does not.

Hixie added a commit to Hixie/flutter that referenced this pull request Jul 20, 2017
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`.
@Hixie
Copy link
Contributor

Hixie commented Jul 20, 2017

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

Hixie added a commit that referenced this pull request Jul 20, 2017
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`.
@danrubel
Copy link
Contributor Author

Sorry about that. Will investigate.

@danrubel danrubel mentioned this pull request Jul 31, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants