Skip to content

Add a diagnostic message in analyze.dart#38355

Merged
LongCatIsLooong merged 2 commits intoflutter:masterfrom
LongCatIsLooong:add-analyzer-diagnostic-message
Jan 9, 2020
Merged

Add a diagnostic message in analyze.dart#38355
LongCatIsLooong merged 2 commits intoflutter:masterfrom
LongCatIsLooong:add-analyzer-diagnostic-message

Conversation

@LongCatIsLooong
Copy link
Copy Markdown
Contributor

@LongCatIsLooong LongCatIsLooong commented Aug 12, 2019

Description

I ran into an analyzer failure in
https://github.com/flutter/flutter/pull/37719/checks?check_run_id=191556624 because I wrote
import 'package:flutter/src/widgets/basic.dart';

the output wasn't the most helpful:

dart --enable-asserts ./dev/bots/analyze.dart
⏩ RUNNING: cd examples/hello_world; ../../bin/flutter inject-plugins
🕐 ELAPSED TIME: 0:00:01.003618 for ../../bin/flutter inject-plugins in examples/hello_world: 
Unhandled exception:
NoSuchMethodError: The getter 'iterator' was called on null.
Receiver: null
Tried calling: iterator
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1      _deepSearch (file:///tmp/flutter%20sdk/dev/bots/analyze.dart:459:20)
#2      _deepSearch (file:///tmp/flutter%20sdk/dev/bots/analyze.dart:464:28)
#3      _verifyNoBadImportsInFlutter (file:///tmp/flutter%20sdk/dev/bots/analyze.dart:393:31)
<asynchronous suspension>
#4      main (file:///tmp/flutter%20sdk/dev/bots/analyze.dart:37:9)
<asynchronous suspension>
#5      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#6      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

Exit status: 255

Now it should say:

⏩ RUNNING: cd ../integration_tests/ui; ../../../bin/flutter inject-plugins
🕐 ELAPSED TIME: 0:00:00.582985 for ../../../bin/flutter inject-plugins in ../integration_tests/ui:
⏩ RUNNING: cd ../../examples/hello_world; ../../bin/flutter inject-plugins
🕐 ELAPSED TIME: 0:00:00.569801 for ../../bin/flutter inject-plugins in ../../examples/hello_world:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
An error was detected when looking at import dependencies within the Flutter package:

cupertino imported package:flutter/src/widgets/basic.dart which is not one of the valid exports { animation.dart, cupertino.dart, foundation.dart, gestures.dart, material.dart, painting.dart, physics.dart, rendering.dart, scheduler.dart, semantics.dart, services.dart, widgets.dart }.                                  
Consider changing src/widgets/basic.dart to one of them.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Tests

Not sure if tests are needed?

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • No, this is not a breaking change.

@fluttergithubbot fluttergithubbot added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Aug 12, 2019
@fluttergithubbot
Copy link
Copy Markdown
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Piinks Piinks added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. team-infra Owned by Infrastructure team labels Jan 7, 2020
Copy link
Copy Markdown
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@LongCatIsLooong LongCatIsLooong force-pushed the add-analyzer-diagnostic-message branch from ae53569 to 894a091 Compare January 9, 2020 00:59
@LongCatIsLooong LongCatIsLooong merged commit d291de0 into flutter:master Jan 9, 2020
@LongCatIsLooong LongCatIsLooong deleted the add-analyzer-diagnostic-message branch January 9, 2020 18:26
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: tests "flutter test", flutter_test, or one of our tests c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels. team-infra Owned by Infrastructure team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants