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

Commit

Permalink
[ci] Improve analysis_options alignment with flutter/packages (#6728)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stuartmorgan committed Nov 21, 2022
1 parent 475caa0 commit 9990a4b
Show file tree
Hide file tree
Showing 52 changed files with 159 additions and 107 deletions.
22 changes: 11 additions & 11 deletions analysis_options.yaml
Expand Up @@ -75,7 +75,7 @@ linter:
- avoid_field_initializers_in_const_classes
# - avoid_final_parameters # incompatible with prefer_final_parameters
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # LOCAL CHANGE - Needs to be enabled and violations fixed.
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
Expand All @@ -87,7 +87,7 @@ linter:
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
# - avoid_returning_null # still violated by some pre-nnbd code that we haven't yet migrated
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
# - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
Expand All @@ -109,15 +109,17 @@ linter:
# - cascade_invocations # doesn't match the typical style of this repo
- cast_nullable_to_non_nullable
# - close_sinks # not reliable enough
# - combinators_ordering # DIFFERENT FROM FLUTTER/FLUTTER: This isn't available on stable yet.
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
# - conditional_uri_does_not_exist # not yet tested
- conditional_uri_does_not_exist
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not required by flutter style
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
- directives_ordering
# - discarded_futures # not yet tested
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
- empty_catches
- empty_constructor_bodies
Expand All @@ -128,7 +130,6 @@ linter:
- flutter_style_todos
- hash_and_equals
- implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
Expand Down Expand Up @@ -203,20 +204,20 @@ linter:
- recursive_getters
# - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
- secure_pubspec_urls
# - sized_box_for_whitespace # LOCAL CHANGE - Needs to be enabled and violations fixed.
- sized_box_for_whitespace

This comment has been minimized.

Copy link
@kevmoo

kevmoo Nov 21, 2022

Contributor

Oops! This messes up parsing!

# - sized_box_shrink_expand # not yet tested
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
- sort_pub_dependencies # DIFFERENT FROM FLUTTER/FLUTTER: Flutter's use case for not sorting does not apply to this repository.
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # too many false positives, especially with the way AnimationController works
# - unnecessary_await_in_return # LOCAL CHANGE - Needs to be enabled and violations fixed.
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
Expand All @@ -226,6 +227,7 @@ linter:
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
Expand All @@ -236,6 +238,7 @@ linter:
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unrelated_type_equality_checks
- unsafe_html
# - use_build_context_synchronously # LOCAL CHANGE - Needs to be enabled and violations fixed.
Expand Down Expand Up @@ -263,6 +266,3 @@ linter:
# separately when moving to a shared file.
- no_runtimeType_toString # use objectRuntimeType from package:foundation
- public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc
# Flutter has a specific use case for dependencies that are intentionally
# not sorted, which doesn't apply to this repo.
- sort_pub_dependencies
Expand Up @@ -1664,7 +1664,7 @@ void main() {
'with notFound error '
'if the camera does not exist', (WidgetTester tester) async {
expect(
() async => await CameraPlatform.instance.getMaxZoomLevel(
() async => CameraPlatform.instance.getMaxZoomLevel(
cameraId,
),
throwsA(
Expand All @@ -1689,7 +1689,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.getMaxZoomLevel(
() async => CameraPlatform.instance.getMaxZoomLevel(
cameraId,
),
throwsA(
Expand Down Expand Up @@ -1717,7 +1717,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.getMaxZoomLevel(
() async => CameraPlatform.instance.getMaxZoomLevel(
cameraId,
),
throwsA(
Expand Down Expand Up @@ -1758,7 +1758,7 @@ void main() {
'with notFound error '
'if the camera does not exist', (WidgetTester tester) async {
expect(
() async => await CameraPlatform.instance.getMinZoomLevel(
() async => CameraPlatform.instance.getMinZoomLevel(
cameraId,
),
throwsA(
Expand All @@ -1783,7 +1783,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.getMinZoomLevel(
() async => CameraPlatform.instance.getMinZoomLevel(
cameraId,
),
throwsA(
Expand Down Expand Up @@ -1811,7 +1811,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.getMinZoomLevel(
() async => CameraPlatform.instance.getMinZoomLevel(
cameraId,
),
throwsA(
Expand Down Expand Up @@ -1846,7 +1846,7 @@ void main() {
'with notFound error '
'if the camera does not exist', (WidgetTester tester) async {
expect(
() async => await CameraPlatform.instance.setZoomLevel(
() async => CameraPlatform.instance.setZoomLevel(
cameraId,
100.0,
),
Expand All @@ -1872,7 +1872,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.setZoomLevel(
() async => CameraPlatform.instance.setZoomLevel(
cameraId,
100.0,
),
Expand Down Expand Up @@ -1900,7 +1900,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.setZoomLevel(
() async => CameraPlatform.instance.setZoomLevel(
cameraId,
100.0,
),
Expand Down Expand Up @@ -1929,7 +1929,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.setZoomLevel(
() async => CameraPlatform.instance.setZoomLevel(
cameraId,
100.0,
),
Expand Down Expand Up @@ -1962,7 +1962,7 @@ void main() {
'with notFound error '
'if the camera does not exist', (WidgetTester tester) async {
expect(
() async => await CameraPlatform.instance.pausePreview(cameraId),
() async => CameraPlatform.instance.pausePreview(cameraId),
throwsA(
isA<PlatformException>().having(
(PlatformException e) => e.code,
Expand All @@ -1985,7 +1985,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.pausePreview(cameraId),
() async => CameraPlatform.instance.pausePreview(cameraId),
throwsA(
isA<PlatformException>().having(
(PlatformException e) => e.code,
Expand Down Expand Up @@ -2017,7 +2017,7 @@ void main() {
'with notFound error '
'if the camera does not exist', (WidgetTester tester) async {
expect(
() async => await CameraPlatform.instance.resumePreview(cameraId),
() async => CameraPlatform.instance.resumePreview(cameraId),
throwsA(
isA<PlatformException>().having(
(PlatformException e) => e.code,
Expand All @@ -2040,7 +2040,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.resumePreview(cameraId),
() async => CameraPlatform.instance.resumePreview(cameraId),
throwsA(
isA<PlatformException>().having(
(PlatformException e) => e.code,
Expand All @@ -2066,7 +2066,7 @@ void main() {
(CameraPlatform.instance as CameraPlugin).cameras[cameraId] = camera;

expect(
() async => await CameraPlatform.instance.resumePreview(cameraId),
() async => CameraPlatform.instance.resumePreview(cameraId),
throwsA(
isA<PlatformException>().having(
(PlatformException e) => e.code,
Expand Down Expand Up @@ -2523,7 +2523,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async => await CameraPlatform.instance.takePicture(cameraId),
() async => CameraPlatform.instance.takePicture(cameraId),
throwsA(
isA<PlatformException>(),
),
Expand Down Expand Up @@ -2560,7 +2560,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async => await CameraPlatform.instance.setFlashMode(
() async => CameraPlatform.instance.setFlashMode(
cameraId,
FlashMode.always,
),
Expand Down Expand Up @@ -2600,7 +2600,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async => await CameraPlatform.instance.getMaxZoomLevel(
() async => CameraPlatform.instance.getMaxZoomLevel(
cameraId,
),
throwsA(
Expand Down Expand Up @@ -2639,7 +2639,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async => await CameraPlatform.instance.getMinZoomLevel(
() async => CameraPlatform.instance.getMinZoomLevel(
cameraId,
),
throwsA(
Expand Down Expand Up @@ -2678,7 +2678,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async => await CameraPlatform.instance.setZoomLevel(
() async => CameraPlatform.instance.setZoomLevel(
cameraId,
100.0,
),
Expand Down Expand Up @@ -2718,7 +2718,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async => await CameraPlatform.instance.resumePreview(cameraId),
() async => CameraPlatform.instance.resumePreview(cameraId),
throwsA(
isA<PlatformException>(),
),
Expand Down Expand Up @@ -2762,8 +2762,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async =>
await CameraPlatform.instance.startVideoRecording(cameraId),
() async => CameraPlatform.instance.startVideoRecording(cameraId),
throwsA(
isA<PlatformException>(),
),
Expand Down Expand Up @@ -2830,8 +2829,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async =>
await CameraPlatform.instance.stopVideoRecording(cameraId),
() async => CameraPlatform.instance.stopVideoRecording(cameraId),
throwsA(
isA<PlatformException>(),
),
Expand Down Expand Up @@ -2868,8 +2866,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async =>
await CameraPlatform.instance.pauseVideoRecording(cameraId),
() async => CameraPlatform.instance.pauseVideoRecording(cameraId),
throwsA(
isA<PlatformException>(),
),
Expand Down Expand Up @@ -2906,8 +2903,7 @@ void main() {
StreamQueue<CameraErrorEvent>(eventStream);

expect(
() async =>
await CameraPlatform.instance.resumeVideoRecording(cameraId),
() async => CameraPlatform.instance.resumeVideoRecording(cameraId),
throwsA(
isA<PlatformException>(),
),
Expand Down
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: avoid_implementing_value_types

import 'dart:async';
import 'dart:html';
import 'dart:ui';
Expand Down
Expand Up @@ -23,7 +23,7 @@ void main() {
(WidgetTester _) async {
final CameraPlatform camera = CameraPlatform.instance;

expect(() async => await camera.initializeCamera(1234),
expect(() async => camera.initializeCamera(1234),
throwsA(isA<CameraException>()));
});
});
Expand All @@ -33,7 +33,7 @@ void main() {
(WidgetTester _) async {
final CameraPlatform camera = CameraPlatform.instance;

expect(() async => await camera.takePicture(1234),
expect(() async => camera.takePicture(1234),
throwsA(isA<PlatformException>()));
});
});
Expand All @@ -43,7 +43,7 @@ void main() {
(WidgetTester _) async {
final CameraPlatform camera = CameraPlatform.instance;

expect(() async => await camera.startVideoRecording(1234),
expect(() async => camera.startVideoRecording(1234),
throwsA(isA<PlatformException>()));
});
});
Expand All @@ -53,7 +53,7 @@ void main() {
(WidgetTester _) async {
final CameraPlatform camera = CameraPlatform.instance;

expect(() async => await camera.stopVideoRecording(1234),
expect(() async => camera.stopVideoRecording(1234),
throwsA(isA<PlatformException>()));
});
});
Expand All @@ -63,7 +63,7 @@ void main() {
(WidgetTester _) async {
final CameraPlatform camera = CameraPlatform.instance;

expect(() async => await camera.pausePreview(1234),
expect(() async => camera.pausePreview(1234),
throwsA(isA<PlatformException>()));
});
});
Expand All @@ -73,7 +73,7 @@ void main() {
(WidgetTester _) async {
final CameraPlatform camera = CameraPlatform.instance;

expect(() async => await camera.resumePreview(1234),
expect(() async => camera.resumePreview(1234),
throwsA(isA<PlatformException>()));
});
});
Expand Down
@@ -1,5 +1,6 @@
## NEXT

* Updates code for new analysis options.
* Updates code for `no_leading_underscores_for_local_identifiers` lint.

## 2.2.1
Expand Down

0 comments on commit 9990a4b

Please sign in to comment.