-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[camera] Ignore implementation imports outside of lib #6191
Conversation
There are libraries outside a `lib/` directory, which violate `implementation_imports`. The fix here is to always add an 'ignore' exception, as the "implementation" being imported is the very package being exemplified. (Maybe that's a perfect reason to re-examine the public API of the package; can you create a good example / example test without importing the private implementation libraries?)
I have many more PRs like this to mail; please let me know how I can proceed; I can keep just adding |
@srawlins if you're finding these inside I'm not sure that redoing the exposed API of the package to expose things "visibleForTesting" is worth it (but we could have a top-level library that reexports what we need just for testing, I guess? It could be done, the implementation packages are private for the users' of a plugin, so they should not be importing from these APIs directly) If you find any of these outside of WDYT @stuartmorgan? |
Yes, there's a very specific pattern for plugins in particular, where the only way to do end-to-end testing of even most individual methods is to run it in the So I agree that we should just treat anything in |
Sounds good! I can follow that pattern; thanks so much for the guidance. |
Thanks @srawlins! Also, if you want to make one big PR with all the changes, I'll get it reviewed and merged as soon as I see it! (or maybe I can create the super big PR if you want) |
Here is the file with all of the lines that need changing (~60) across this repo: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8756626596148228113/+/u/analyze_flutter_packages/stdout?format=raw WDYT about fixing them? I was going to do it more incrementally, and on the back burner. But I'd love if you wanted to clean them up 😁 |
Yep, I'll try to get this later tonight. |
Why is it flagging things in |
@stuartmorgan Do you mean these lines?
These correspond to these source lines: import 'package:flutter/src/foundation/basic_types.dart';
import 'package:flutter/src/gestures/recognizer.dart';
...
import 'package:webview_flutter/src/webview_flutter_legacy.dart'; Those imports are considered "implementation imports." Should |
Is |
Oh I see you mean the third import there. That does seem odd. I can look into that. |
It seems the But my analyzer is not picking any of those up: dit@dit:/work/flutter/packages/packages/camera/camera_web/example/integration_test$ flutter analyze .
Analyzing integration_test...
No issues found! (ran in 2.8s)
dit@dit:/work/flutter/packages/packages/camera/camera_web/example/integration_test$ dart analyze .
Analyzing .... 1.3s
No issues found! How can I modify our analysis_options.yaml so I can generate my list of affected files? |
I think it would be quite a bit of effort, to re-create the fix for dart-lang/linter#4859 in a custom Dart SDK and use that to analyze this repo. The only way I know how is with the bot that generated that report. 😁 |
Ahhh oof, didn't realize this was a change in the behavior of the lint itself! (PS: will try again tomorrow, it's a little bit late now in PT!) |
My bad, the third violating import is this one:
line-off-by-one human-error 😁 |
Thanks, that makes more sense. That one we can ignore since it's a very weird special case (upstream testing of something that's a use case that's only allowed within google3). The |
From triage: What's the status of this PR? |
Ready to go 😄 |
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
Agh, totally forgot about this one. Thanks @srawlins! 🙇 |
No worries! Not high priority |
flutter/packages@5ccddfc...8de142d 2024-05-07 [email protected] [path_provider] Add Swift Package Manager support (flutter/packages#6680) 2024-05-07 [email protected] [go_router] guard context access in then clauses (flutter/packages#6685) 2024-05-07 [email protected] Roll Flutter from 04424e1 to 7920a52 (27 revisions) (flutter/packages#6683) 2024-05-07 [email protected] [camera] Ignore implementation imports outside of lib (flutter/packages#6191) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Work towards dart-lang/linter#4859 There are libraries outside a `lib/` directory, which violate `implementation_imports`. The fix here is to always add an 'ignore' exception, as the "implementation" being imported is the very package being exemplified. (Maybe that's a perfect reason to re-examine the public API of the package; can you create a good example / example test without importing the private implementation libraries?) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use `dart format`.) - [x] I signed the [CLA]. - [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. `[shared_preferences]` - [x] I [linked to at least one issue that this PR fixes] in the description above. - [x] I updated `pubspec.yaml` with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes]. - [ ] I updated `CHANGELOG.md` to add a description of the change, [following repository CHANGELOG style]. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [relevant style guides]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md#style [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [linked to at least one issue that this PR fixes]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [pub versioning philosophy]: https://dart.dev/tools/pub/versioning [exempt from version changes]: https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#version-and-changelog-updates [following repository CHANGELOG style]: https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changelog-style [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
Work towards dart-lang/linter#4859 There are libraries outside a `lib/` directory, which violate `implementation_imports`. The fix here is to always add an 'ignore' exception, as the "implementation" being imported is the very package being exemplified. (Maybe that's a perfect reason to re-examine the public API of the package; can you create a good example / example test without importing the private implementation libraries?) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use `dart format`.) - [x] I signed the [CLA]. - [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. `[shared_preferences]` - [x] I [linked to at least one issue that this PR fixes] in the description above. - [x] I updated `pubspec.yaml` with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes]. - [ ] I updated `CHANGELOG.md` to add a description of the change, [following repository CHANGELOG style]. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [relevant style guides]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md#style [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [linked to at least one issue that this PR fixes]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [pub versioning philosophy]: https://dart.dev/tools/pub/versioning [exempt from version changes]: https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#version-and-changelog-updates [following repository CHANGELOG style]: https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changelog-style [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
Work towards dart-lang/linter#4859
There are libraries outside a
lib/
directory, which violateimplementation_imports
. The fix here is to always add an 'ignore' exception, as the "implementation" being imported is the very package being exemplified.(Maybe that's a perfect reason to re-examine the public API of the package; can you create a good example / example test without importing the private implementation libraries?)
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.