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

Commit 9990a4b

Browse files
[ci] Improve analysis_options alignment with flutter/packages (#6728)
* Add more options that are in flutter/packages * Fix unnecessary awaits * More option alignment * Add and locally supress avoid_implementing_value_types * Fix release-info for test-only changes * Fix update-release-info handling of 'minimal' * Update release metadata
1 parent 475caa0 commit 9990a4b

File tree

52 files changed

+159
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+159
-107
lines changed

analysis_options.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ linter:
7575
- avoid_field_initializers_in_const_classes
7676
# - avoid_final_parameters # incompatible with prefer_final_parameters
7777
- avoid_function_literals_in_foreach_calls
78-
# - avoid_implementing_value_types # LOCAL CHANGE - Needs to be enabled and violations fixed.
78+
- avoid_implementing_value_types
7979
- avoid_init_to_null
8080
- avoid_js_rounded_ints
8181
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
@@ -87,7 +87,7 @@ linter:
8787
- avoid_relative_lib_imports
8888
- avoid_renaming_method_parameters
8989
- avoid_return_types_on_setters
90-
# - avoid_returning_null # still violated by some pre-nnbd code that we haven't yet migrated
90+
- avoid_returning_null
9191
- avoid_returning_null_for_future
9292
- avoid_returning_null_for_void
9393
# - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
@@ -109,15 +109,17 @@ linter:
109109
# - cascade_invocations # doesn't match the typical style of this repo
110110
- cast_nullable_to_non_nullable
111111
# - close_sinks # not reliable enough
112+
# - combinators_ordering # DIFFERENT FROM FLUTTER/FLUTTER: This isn't available on stable yet.
112113
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
113-
# - conditional_uri_does_not_exist # not yet tested
114+
- conditional_uri_does_not_exist
114115
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
115116
- control_flow_in_finally
116-
# - curly_braces_in_flow_control_structures # not required by flutter style
117+
- curly_braces_in_flow_control_structures
117118
- depend_on_referenced_packages
118119
- deprecated_consistency
119120
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
120121
- directives_ordering
122+
# - discarded_futures # not yet tested
121123
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
122124
- empty_catches
123125
- empty_constructor_bodies
@@ -128,7 +130,6 @@ linter:
128130
- flutter_style_todos
129131
- hash_and_equals
130132
- implementation_imports
131-
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
132133
- iterable_contains_unrelated_type
133134
# - join_return_with_assignment # not required by flutter style
134135
- leading_newlines_in_multiline_strings
@@ -203,20 +204,20 @@ linter:
203204
- recursive_getters
204205
# - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
205206
- secure_pubspec_urls
206-
# - sized_box_for_whitespace # LOCAL CHANGE - Needs to be enabled and violations fixed.
207+
- sized_box_for_whitespace
207208
# - sized_box_shrink_expand # not yet tested
208209
- slash_for_doc_comments
209210
- sort_child_properties_last
210211
- sort_constructors_first
211-
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
212+
- sort_pub_dependencies # DIFFERENT FROM FLUTTER/FLUTTER: Flutter's use case for not sorting does not apply to this repository.
212213
- sort_unnamed_constructors_first
213214
- test_types_in_equals
214215
- throw_in_finally
215216
- tighten_type_of_initializing_formals
216217
# - type_annotate_public_apis # subset of always_specify_types
217218
- type_init_formals
218219
# - unawaited_futures # too many false positives, especially with the way AnimationController works
219-
# - unnecessary_await_in_return # LOCAL CHANGE - Needs to be enabled and violations fixed.
220+
- unnecessary_await_in_return
220221
- unnecessary_brace_in_string_interps
221222
- unnecessary_const
222223
- unnecessary_constructor_name
@@ -226,6 +227,7 @@ linter:
226227
- unnecessary_late
227228
- unnecessary_new
228229
- unnecessary_null_aware_assignments
230+
- unnecessary_null_aware_operator_on_extension_on_nullable
229231
- unnecessary_null_checks
230232
- unnecessary_null_in_if_null_operators
231233
- unnecessary_nullable_for_final_variable_declarations
@@ -236,6 +238,7 @@ linter:
236238
- unnecessary_string_escapes
237239
- unnecessary_string_interpolations
238240
- unnecessary_this
241+
- unnecessary_to_list_in_spreads
239242
- unrelated_type_equality_checks
240243
- unsafe_html
241244
# - use_build_context_synchronously # LOCAL CHANGE - Needs to be enabled and violations fixed.
@@ -263,6 +266,3 @@ linter:
263266
# separately when moving to a shared file.
264267
- no_runtimeType_toString # use objectRuntimeType from package:foundation
265268
- public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc
266-
# Flutter has a specific use case for dependencies that are intentionally
267-
# not sorted, which doesn't apply to this repo.
268-
- sort_pub_dependencies

packages/camera/camera_web/example/integration_test/camera_web_test.dart

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ void main() {
16641664
'with notFound error '
16651665
'if the camera does not exist', (WidgetTester tester) async {
16661666
expect(
1667-
() async => await CameraPlatform.instance.getMaxZoomLevel(
1667+
() async => CameraPlatform.instance.getMaxZoomLevel(
16681668
cameraId,
16691669
),
16701670
throwsA(
@@ -1689,7 +1689,7 @@ void main() {
16891689
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
16901690

16911691
expect(
1692-
() async => await CameraPlatform.instance.getMaxZoomLevel(
1692+
() async => CameraPlatform.instance.getMaxZoomLevel(
16931693
cameraId,
16941694
),
16951695
throwsA(
@@ -1717,7 +1717,7 @@ void main() {
17171717
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
17181718

17191719
expect(
1720-
() async => await CameraPlatform.instance.getMaxZoomLevel(
1720+
() async => CameraPlatform.instance.getMaxZoomLevel(
17211721
cameraId,
17221722
),
17231723
throwsA(
@@ -1758,7 +1758,7 @@ void main() {
17581758
'with notFound error '
17591759
'if the camera does not exist', (WidgetTester tester) async {
17601760
expect(
1761-
() async => await CameraPlatform.instance.getMinZoomLevel(
1761+
() async => CameraPlatform.instance.getMinZoomLevel(
17621762
cameraId,
17631763
),
17641764
throwsA(
@@ -1783,7 +1783,7 @@ void main() {
17831783
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
17841784

17851785
expect(
1786-
() async => await CameraPlatform.instance.getMinZoomLevel(
1786+
() async => CameraPlatform.instance.getMinZoomLevel(
17871787
cameraId,
17881788
),
17891789
throwsA(
@@ -1811,7 +1811,7 @@ void main() {
18111811
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
18121812

18131813
expect(
1814-
() async => await CameraPlatform.instance.getMinZoomLevel(
1814+
() async => CameraPlatform.instance.getMinZoomLevel(
18151815
cameraId,
18161816
),
18171817
throwsA(
@@ -1846,7 +1846,7 @@ void main() {
18461846
'with notFound error '
18471847
'if the camera does not exist', (WidgetTester tester) async {
18481848
expect(
1849-
() async => await CameraPlatform.instance.setZoomLevel(
1849+
() async => CameraPlatform.instance.setZoomLevel(
18501850
cameraId,
18511851
100.0,
18521852
),
@@ -1872,7 +1872,7 @@ void main() {
18721872
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
18731873

18741874
expect(
1875-
() async => await CameraPlatform.instance.setZoomLevel(
1875+
() async => CameraPlatform.instance.setZoomLevel(
18761876
cameraId,
18771877
100.0,
18781878
),
@@ -1900,7 +1900,7 @@ void main() {
19001900
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
19011901

19021902
expect(
1903-
() async => await CameraPlatform.instance.setZoomLevel(
1903+
() async => CameraPlatform.instance.setZoomLevel(
19041904
cameraId,
19051905
100.0,
19061906
),
@@ -1929,7 +1929,7 @@ void main() {
19291929
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
19301930

19311931
expect(
1932-
() async => await CameraPlatform.instance.setZoomLevel(
1932+
() async => CameraPlatform.instance.setZoomLevel(
19331933
cameraId,
19341934
100.0,
19351935
),
@@ -1962,7 +1962,7 @@ void main() {
19621962
'with notFound error '
19631963
'if the camera does not exist', (WidgetTester tester) async {
19641964
expect(
1965-
() async => await CameraPlatform.instance.pausePreview(cameraId),
1965+
() async => CameraPlatform.instance.pausePreview(cameraId),
19661966
throwsA(
19671967
isA<PlatformException>().having(
19681968
(PlatformException e) => e.code,
@@ -1985,7 +1985,7 @@ void main() {
19851985
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
19861986

19871987
expect(
1988-
() async => await CameraPlatform.instance.pausePreview(cameraId),
1988+
() async => CameraPlatform.instance.pausePreview(cameraId),
19891989
throwsA(
19901990
isA<PlatformException>().having(
19911991
(PlatformException e) => e.code,
@@ -2017,7 +2017,7 @@ void main() {
20172017
'with notFound error '
20182018
'if the camera does not exist', (WidgetTester tester) async {
20192019
expect(
2020-
() async => await CameraPlatform.instance.resumePreview(cameraId),
2020+
() async => CameraPlatform.instance.resumePreview(cameraId),
20212021
throwsA(
20222022
isA<PlatformException>().having(
20232023
(PlatformException e) => e.code,
@@ -2040,7 +2040,7 @@ void main() {
20402040
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
20412041

20422042
expect(
2043-
() async => await CameraPlatform.instance.resumePreview(cameraId),
2043+
() async => CameraPlatform.instance.resumePreview(cameraId),
20442044
throwsA(
20452045
isA<PlatformException>().having(
20462046
(PlatformException e) => e.code,
@@ -2066,7 +2066,7 @@ void main() {
20662066
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;
20672067

20682068
expect(
2069-
() async => await CameraPlatform.instance.resumePreview(cameraId),
2069+
() async => CameraPlatform.instance.resumePreview(cameraId),
20702070
throwsA(
20712071
isA<PlatformException>().having(
20722072
(PlatformException e) => e.code,
@@ -2523,7 +2523,7 @@ void main() {
25232523
StreamQueue<CameraErrorEvent>(eventStream);
25242524

25252525
expect(
2526-
() async => await CameraPlatform.instance.takePicture(cameraId),
2526+
() async => CameraPlatform.instance.takePicture(cameraId),
25272527
throwsA(
25282528
isA<PlatformException>(),
25292529
),
@@ -2560,7 +2560,7 @@ void main() {
25602560
StreamQueue<CameraErrorEvent>(eventStream);
25612561

25622562
expect(
2563-
() async => await CameraPlatform.instance.setFlashMode(
2563+
() async => CameraPlatform.instance.setFlashMode(
25642564
cameraId,
25652565
FlashMode.always,
25662566
),
@@ -2600,7 +2600,7 @@ void main() {
26002600
StreamQueue<CameraErrorEvent>(eventStream);
26012601

26022602
expect(
2603-
() async => await CameraPlatform.instance.getMaxZoomLevel(
2603+
() async => CameraPlatform.instance.getMaxZoomLevel(
26042604
cameraId,
26052605
),
26062606
throwsA(
@@ -2639,7 +2639,7 @@ void main() {
26392639
StreamQueue<CameraErrorEvent>(eventStream);
26402640

26412641
expect(
2642-
() async => await CameraPlatform.instance.getMinZoomLevel(
2642+
() async => CameraPlatform.instance.getMinZoomLevel(
26432643
cameraId,
26442644
),
26452645
throwsA(
@@ -2678,7 +2678,7 @@ void main() {
26782678
StreamQueue<CameraErrorEvent>(eventStream);
26792679

26802680
expect(
2681-
() async => await CameraPlatform.instance.setZoomLevel(
2681+
() async => CameraPlatform.instance.setZoomLevel(
26822682
cameraId,
26832683
100.0,
26842684
),
@@ -2718,7 +2718,7 @@ void main() {
27182718
StreamQueue<CameraErrorEvent>(eventStream);
27192719

27202720
expect(
2721-
() async => await CameraPlatform.instance.resumePreview(cameraId),
2721+
() async => CameraPlatform.instance.resumePreview(cameraId),
27222722
throwsA(
27232723
isA<PlatformException>(),
27242724
),
@@ -2762,8 +2762,7 @@ void main() {
27622762
StreamQueue<CameraErrorEvent>(eventStream);
27632763

27642764
expect(
2765-
() async =>
2766-
await CameraPlatform.instance.startVideoRecording(cameraId),
2765+
() async => CameraPlatform.instance.startVideoRecording(cameraId),
27672766
throwsA(
27682767
isA<PlatformException>(),
27692768
),
@@ -2830,8 +2829,7 @@ void main() {
28302829
StreamQueue<CameraErrorEvent>(eventStream);
28312830

28322831
expect(
2833-
() async =>
2834-
await CameraPlatform.instance.stopVideoRecording(cameraId),
2832+
() async => CameraPlatform.instance.stopVideoRecording(cameraId),
28352833
throwsA(
28362834
isA<PlatformException>(),
28372835
),
@@ -2868,8 +2866,7 @@ void main() {
28682866
StreamQueue<CameraErrorEvent>(eventStream);
28692867

28702868
expect(
2871-
() async =>
2872-
await CameraPlatform.instance.pauseVideoRecording(cameraId),
2869+
() async => CameraPlatform.instance.pauseVideoRecording(cameraId),
28732870
throwsA(
28742871
isA<PlatformException>(),
28752872
),
@@ -2906,8 +2903,7 @@ void main() {
29062903
StreamQueue<CameraErrorEvent>(eventStream);
29072904

29082905
expect(
2909-
() async =>
2910-
await CameraPlatform.instance.resumeVideoRecording(cameraId),
2906+
() async => CameraPlatform.instance.resumeVideoRecording(cameraId),
29112907
throwsA(
29122908
isA<PlatformException>(),
29132909
),

packages/camera/camera_web/example/integration_test/helpers/mocks.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// ignore_for_file: avoid_implementing_value_types
6+
57
import 'dart:async';
68
import 'dart:html';
79
import 'dart:ui';

packages/camera/camera_windows/example/integration_test/camera_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void main() {
2323
(WidgetTester _) async {
2424
final CameraPlatform camera = CameraPlatform.instance;
2525

26-
expect(() async => await camera.initializeCamera(1234),
26+
expect(() async => camera.initializeCamera(1234),
2727
throwsA(isA<CameraException>()));
2828
});
2929
});
@@ -33,7 +33,7 @@ void main() {
3333
(WidgetTester _) async {
3434
final CameraPlatform camera = CameraPlatform.instance;
3535

36-
expect(() async => await camera.takePicture(1234),
36+
expect(() async => camera.takePicture(1234),
3737
throwsA(isA<PlatformException>()));
3838
});
3939
});
@@ -43,7 +43,7 @@ void main() {
4343
(WidgetTester _) async {
4444
final CameraPlatform camera = CameraPlatform.instance;
4545

46-
expect(() async => await camera.startVideoRecording(1234),
46+
expect(() async => camera.startVideoRecording(1234),
4747
throwsA(isA<PlatformException>()));
4848
});
4949
});
@@ -53,7 +53,7 @@ void main() {
5353
(WidgetTester _) async {
5454
final CameraPlatform camera = CameraPlatform.instance;
5555

56-
expect(() async => await camera.stopVideoRecording(1234),
56+
expect(() async => camera.stopVideoRecording(1234),
5757
throwsA(isA<PlatformException>()));
5858
});
5959
});
@@ -63,7 +63,7 @@ void main() {
6363
(WidgetTester _) async {
6464
final CameraPlatform camera = CameraPlatform.instance;
6565

66-
expect(() async => await camera.pausePreview(1234),
66+
expect(() async => camera.pausePreview(1234),
6767
throwsA(isA<PlatformException>()));
6868
});
6969
});
@@ -73,7 +73,7 @@ void main() {
7373
(WidgetTester _) async {
7474
final CameraPlatform camera = CameraPlatform.instance;
7575

76-
expect(() async => await camera.resumePreview(1234),
76+
expect(() async => camera.resumePreview(1234),
7777
throwsA(isA<PlatformException>()));
7878
});
7979
});

packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## NEXT
22

3+
* Updates code for new analysis options.
34
* Updates code for `no_leading_underscores_for_local_identifiers` lint.
45

56
## 2.2.1

0 commit comments

Comments
 (0)