Skip to content

Commit

Permalink
[various] Enable warnings as errors, and all warnings, for Android li…
Browse files Browse the repository at this point in the history
…nt (#3648)

For all Android plugins:
- Enable all warnings for `lint`
- Treat all warnings as errors for `lint`

This significantly increases the scope of issues that we'll catch in CI. To
allow enabling this without having to make tons of fixes first, so that
we get the incremental benefit immediately, this adds new baselines for
all plugins. We can incrementally clean those baselines up over time.
(In practice we haven't prioritized that, but it would be good to start
paying down that technical debt incrementally at some point.)

See flutter/flutter#88011
  • Loading branch information
stuartmorgan authored Apr 7, 2023
1 parent 3437d91 commit 87459c4
Show file tree
Hide file tree
Showing 32 changed files with 13,996 additions and 309 deletions.
2 changes: 2 additions & 0 deletions packages/camera/camera_android/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}
Expand Down
3,126 changes: 3,059 additions & 67 deletions packages/camera/camera_android/android/lint-baseline.xml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions packages/camera/camera_android_camerax/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ android {
}

lintOptions {
disable 'AndroidGradlePluginVersion'
disable 'GradleDependency'
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'GradleDependency', 'InvalidPackage'
baseline file("lint-baseline.xml")
}
}

Expand Down
1,434 changes: 1,434 additions & 0 deletions packages/camera/camera_android_camerax/android/lint-baseline.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/espresso/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}
Expand Down
2,453 changes: 2,244 additions & 209 deletions packages/espresso/android/lint-baseline.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ android {
consumerProguardFiles 'proguard.txt'
}
lintOptions {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 7.4.2" type="baseline" client="gradle" dependencies="false" name="AGP (7.4.2)" variant="all" version="7.4.2">

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
errorLine1=" public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle/FlutterAndroidLifecyclePlugin.java"
line="18"
column="35"/>
</issue>

</issues>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 7.0.1" type="baseline" client="gradle" name="AGP (7.0.1)" variant="all" version="7.0.1">

<issue
id="SyntheticAccessor"
message="Access to `private` field `loadedCallbackPending` of class `GoogleMapController` requires synthetic accessor"
errorLine1=" loadedCallbackPending = false;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
line="165"
column="13"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `postFrameCallback` of class `GoogleMapController` requires synthetic accessor"
errorLine1=" postFrameCallback("
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
line="166"
column="13"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `postFrameCallback` of class `GoogleMapController` requires synthetic accessor"
errorLine1=" postFrameCallback("
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
line="168"
column="19"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` field `mapView` of class `GoogleMapController` requires synthetic accessor"
errorLine1=" if (mapView != null) {"
errorLine2=" ~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
line="170"
column="29"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` field `mapView` of class `GoogleMapController` requires synthetic accessor"
errorLine1=" mapView.invalidate();"
errorLine2=" ~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
line="171"
column="27"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` constructor of class `ProxyLifecycleProvider` requires synthetic accessor"
errorLine1=" new ProxyLifecycleProvider(activity)));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
line="64"
column="19"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` field `lifecycle` of class `GoogleMapsPlugin` requires synthetic accessor"
errorLine1=" return lifecycle;"
errorLine2=" ~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
line="85"
column="28"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` field `handler` of class `TileProviderController` requires synthetic accessor"
errorLine1=" handler.post("
errorLine2=" ~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java"
line="52"
column="7"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` field `methodChannel` of class `TileProviderController` requires synthetic accessor"
errorLine1=" methodChannel.invokeMethod("
errorLine2=" ~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java"
line="54"
column="15"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` field `tileOverlayId` of class `TileProviderController` requires synthetic accessor"
errorLine1=" Convert.tileOverlayArgumentsToJson(tileOverlayId, x, y, zoom),"
errorLine2=" ~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java"
line="56"
column="54"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public PlatformView create(Context context, int id, Object args) {"
errorLine2=" ~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java"
line="33"
column="10"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public PlatformView create(Context context, int id, Object args) {"
errorLine2=" ~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java"
line="33"
column="30"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public PlatformView create(Context context, int id, Object args) {"
errorLine2=" ~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java"
line="33"
column="55"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
line="35"
column="13"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public void onAttachedToEngine(FlutterPluginBinding binding) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
line="73"
column="34"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public void onDetachedFromEngine(FlutterPluginBinding binding) {}"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
line="91"
column="36"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public void onAttachedToActivity(ActivityPluginBinding binding) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
line="96"
column="36"/>
</issue>

<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
line="106"
column="54"/>
</issue>

</issues>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}


Expand Down
Loading

0 comments on commit 87459c4

Please sign in to comment.