Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Jan 31, 2022

Switches from legacy analysis options to current analysis options,
fixing all analysis issues it exposed.

Part of flutter/flutter#76229

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • 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 ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@stuartmorgan-g
Copy link
Contributor

We do not want custom analysis rules in flutter/plugins. See flutter/flutter#76229 if you are interested in fixing analysis issues in the maps plugin, as that's the direction we want to go.

If there are things in flutter_lints that aren't in the repository settings, we should evaluate adding them there so the apply to all code.

@TahaTesser
Copy link
Member Author

TahaTesser commented Jan 31, 2022

@stuartmorgan
Does it mean I update all the 3 maps packages in https://github.com/flutter/plugins/tree/main/packages/google_maps_flutter?

Since custom_analysis.yaml has entire google_maps_flutter, not just its example
I found that i need to update interface package too since just migrating google_maps_flutter causes the tests to fail as it expects certain types during the test.

@stuartmorgan-g
Copy link
Contributor

Does it mean I update the all the 3 maps packages in https://github.com/flutter/plugins/tree/main/packages/google_maps_flutter?

Since custom_analysis.yaml has entire google_maps_flutter, not just its example

You need to do the entire package, not just the example. You don't need to do all three at once (and ideally shouldn't).

I found that i need to update interface package too since just migrating google_maps_flutter causes the tests to fail as it expects certain types during the test.

I'm not sure what this means. What runtime type changes were you making?

@TahaTesser

This comment was marked as resolved.

@stuartmorgan-g
Copy link
Contributor

probably because i have assigned types to quite a few maps in the codebase

If this includes method channel code, you need to be very careful do do the right combinations of as with dynamic and then casting.

@stuartmorgan-g stuartmorgan-g marked this pull request as draft February 4, 2022 21:35
@TahaTesser TahaTesser changed the title [google_maps_flutter] Add flutter_lints to the example and fix lint issues [google_maps_flutter] Switch app-facing package to new analysis options Feb 13, 2022
@TahaTesser
Copy link
Member Author

@stuartmorgan
Following the instructions, I've made the changes. If it looks fine, I would move to other packages ASAP :)

@stuartmorgan-g
Copy link
Contributor

It looks like this doesn't pass tests currently.

@TahaTesser
Copy link
Member Author

Hey @stuartmorgan
Can you please take a look, tests are passing except publishable and submit queue? I tried providing a changelog but still fails.

@TahaTesser TahaTesser marked this pull request as ready for review February 18, 2022 20:01
@TahaTesser
Copy link
Member Author

@stuartmorgan
fixed the changelog :)

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Thanks for this cleanup! Just a few small things.

await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));

p1.points.add(const LatLng(1.0, 1.0));
_points.add(const LatLng(1.0, 1.0));
Copy link
Contributor

Choose a reason for hiding this comment

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

What was this set of changes fixing? The code seems less clear now, so I'm wondering if we can fix it differently.

Copy link
Member Author

@TahaTesser TahaTesser Feb 25, 2022

Choose a reason for hiding this comment

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

I meant to add final List<LatLng> _points = <LatLng>[const LatLng(0.0, 0.0)]; to p1, to make _points list modifiable
Otherwise, it throws Unsupported operation: Cannot add to an unmodifiable list

During local testing, I modified this line and probably forget to revert this line after making the changes above, thanks

+   final List<LatLng> _points = <LatLng>[const LatLng(0.0, 0.0)];
     final Polygon p1 = Polygon(
-    polylineId: PolylineId("polyline_1"),
+   polygonId: const PolygonId('polygon_1'),
-    points: <LatLng>[const LatLng(0.0, 0.0)],
+   points: _points,
    );
    await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));

    p1.points.add(const LatLng(1.0, 1.0));

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, the reason this code looks strange is because it is; looking at the blame this is testing that we notice if someone modifies what is supposed to be an immutable object.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

await tester.pumpWidget(_mapWithPolygons(<Polygon>{p1}));

p1.points.add(const LatLng(1.0, 1.0));
_points.add(const LatLng(1.0, 1.0));
Copy link
Contributor

Choose a reason for hiding this comment

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

I see, the reason this code looks strange is because it is; looking at the blame this is testing that we notice if someone modifies what is supposed to be an immutable object.

@stuartmorgan-g stuartmorgan-g added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Mar 1, 2022
@fluttergithubbot fluttergithubbot merged commit 868086b into flutter:main Mar 1, 2022
@TahaTesser TahaTesser deleted the maps_lint_fixes branch March 2, 2022 08:13
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

p: google_maps_flutter waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants