Skip to content

Commit e5a7fb0

Browse files
authored
Sync with analysis_options.yaml in flutter/packages (#675)
1 parent 0bbced7 commit e5a7fb0

File tree

5 files changed

+48
-35
lines changed

5 files changed

+48
-35
lines changed

analysis_options.yaml

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# This file is a copy of analysis_options.yaml from flutter/packages repo
2-
# as of 2023-03-07.
2+
# as of 2024-03-07.
33

44
analyzer:
55
language:
66
strict-casts: true
7+
strict-inference: true
78
strict-raw-types: true
89
errors:
9-
# allow self-reference to deprecated members (we do this because otherwise we have
10-
# to annotate every member in every test, assert, etc, when we deprecate something)
10+
# allow deprecated members (we do this because otherwise we have to annotate
11+
# every member in every test, assert, etc, when we or the Dart SDK deprecates
12+
# something (https://github.com/flutter/flutter/issues/143312)
13+
deprecated_member_use: ignore
1114
deprecated_member_use_from_same_package: ignore
12-
# Turned off until null-safe rollout is complete.
13-
unnecessary_null_comparison: ignore
15+
unnecessary_null_comparison: ignore # Temporarily ingnored from flutter-tizen.
1416
exclude: # DIFFERENT FROM FLUTTER/FLUTTER
1517
# Ignore generated files
1618
- '**/*.g.dart'
@@ -19,19 +21,18 @@ analyzer:
1921
linter:
2022
rules:
2123
# This list is derived from the list of all available lints located at
22-
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
24+
# https://github.com/dart-lang/linter/blob/main/example/all.yaml
2325
- always_declare_return_types
2426
- always_put_control_body_on_new_line
2527
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
26-
- always_require_non_null_named_parameters
2728
- always_specify_types
2829
# - always_use_package_imports # we do this commonly
2930
- annotate_overrides
3031
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
3132
- avoid_bool_literals_in_conditional_expressions
3233
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
3334
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
34-
- avoid_classes_with_only_static_members
35+
# - avoid_classes_with_only_static_members # we do this commonly for `abstract final class`es
3536
- avoid_double_and_int_checks
3637
- avoid_dynamic_calls
3738
- avoid_empty_else
@@ -40,7 +41,7 @@ linter:
4041
- avoid_field_initializers_in_const_classes
4142
# - avoid_final_parameters # incompatible with prefer_final_parameters
4243
- avoid_function_literals_in_foreach_calls
43-
- avoid_implementing_value_types
44+
# - avoid_implementing_value_types # see https://github.com/dart-lang/linter/issues/4558
4445
- avoid_init_to_null
4546
- avoid_js_rounded_ints
4647
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
@@ -52,8 +53,6 @@ linter:
5253
- avoid_relative_lib_imports
5354
- avoid_renaming_method_parameters
5455
- avoid_return_types_on_setters
55-
- avoid_returning_null
56-
- avoid_returning_null_for_future
5756
- avoid_returning_null_for_void
5857
# - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
5958
- avoid_setters_without_getters
@@ -74,17 +73,20 @@ linter:
7473
# - cascade_invocations # doesn't match the typical style of this repo
7574
- cast_nullable_to_non_nullable
7675
# - close_sinks # not reliable enough
77-
# - combinators_ordering # DIFFERENT FROM FLUTTER/FLUTTER: This isn't available on stable yet.
76+
- collection_methods_unrelated_type
77+
- combinators_ordering
7878
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
7979
- conditional_uri_does_not_exist
8080
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
8181
- control_flow_in_finally
8282
- curly_braces_in_flow_control_structures
83+
# - dangling_library_doc_comments # Temporarily ingnored from flutter-tizen.
8384
- depend_on_referenced_packages
8485
- deprecated_consistency
86+
# - deprecated_member_use_from_same_package # we allow self-references to deprecated members
8587
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
8688
- directives_ordering
87-
# - discarded_futures # not yet tested
89+
# - discarded_futures # too many false positives, similar to unawaited_futures
8890
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
8991
- empty_catches
9092
- empty_constructor_bodies
@@ -95,23 +97,29 @@ linter:
9597
- flutter_style_todos
9698
- hash_and_equals
9799
- implementation_imports
98-
- iterable_contains_unrelated_type
100+
- implicit_call_tearoffs
101+
- implicit_reopen
102+
- invalid_case_patterns
99103
# - join_return_with_assignment # not required by flutter style
100104
- leading_newlines_in_multiline_strings
105+
- library_annotations
101106
- library_names
102107
- library_prefixes
103108
- library_private_types_in_public_api
104109
# - lines_longer_than_80_chars # not required by flutter style
105-
- list_remove_unrelated_type
106-
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
110+
- literal_only_boolean_expressions
111+
# - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509
107112
- missing_whitespace_between_adjacent_strings
108113
- no_adjacent_strings_in_list
109114
- no_default_cases
110115
- no_duplicate_case_values
111116
- no_leading_underscores_for_library_prefixes
112117
- no_leading_underscores_for_local_identifiers
118+
# - no_literal_bool_comparisons # Temporarily ingnored from flutter-tizen.
113119
- no_logic_in_create_state
114120
- no_runtimeType_toString # DIFFERENT FROM FLUTTER/FLUTTER
121+
- no_self_assignments
122+
- no_wildcard_variable_uses
115123
- non_constant_identifier_names
116124
- noop_primitive_operations
117125
- null_check_on_nullable_type_parameter
@@ -136,12 +144,11 @@ linter:
136144
# - prefer_constructors_over_static_methods # far too many false positives
137145
- prefer_contains
138146
# - prefer_double_quotes # opposite of prefer_single_quotes
139-
- prefer_equal_for_default_values
140147
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
141148
- prefer_final_fields
142149
- prefer_final_in_for_each
143150
- prefer_final_locals
144-
# - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments
151+
# - prefer_final_parameters # adds too much verbosity
145152
- prefer_for_elements_to_map_fromIterable
146153
- prefer_foreach
147154
- prefer_function_declarations_over_variables
@@ -156,7 +163,7 @@ linter:
156163
- prefer_is_not_empty
157164
- prefer_is_not_operator
158165
- prefer_iterable_whereType
159-
# - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
166+
- prefer_mixin
160167
# - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
161168
- prefer_null_aware_operators
162169
- prefer_relative_imports
@@ -167,10 +174,10 @@ linter:
167174
- provide_deprecation_message
168175
- public_member_api_docs # DIFFERENT FROM FLUTTER/FLUTTER
169176
- recursive_getters
170-
# - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
177+
# - require_trailing_commas # would be nice, but requires a lot of manual work: 10,000+ code locations would need to be reformatted by hand after bulk fix is applied
171178
- secure_pubspec_urls
172179
- sized_box_for_whitespace
173-
# - sized_box_shrink_expand # not yet tested
180+
- sized_box_shrink_expand
174181
- slash_for_doc_comments
175182
- sort_child_properties_last
176183
- sort_constructors_first
@@ -181,15 +188,18 @@ linter:
181188
- tighten_type_of_initializing_formals
182189
# - type_annotate_public_apis # subset of always_specify_types
183190
- type_init_formals
184-
# - unawaited_futures # too many false positives, especially with the way AnimationController works
191+
- type_literal_in_constant_pattern
192+
# - unawaited_futures # DIFFERENT FROM FLUTTER/FLUTTER: It's disabled there for "too many false positives"; that's not an issue here, and missing awaits have caused production issues in plugins. # Temporarily ingnored from flutter-tizen.
185193
- unnecessary_await_in_return
186194
- unnecessary_brace_in_string_interps
195+
- unnecessary_breaks
187196
- unnecessary_const
188197
- unnecessary_constructor_name
189198
# - unnecessary_final # conflicts with prefer_final_locals
190199
- unnecessary_getters_setters
191200
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
192201
- unnecessary_late
202+
# - unnecessary_library_directive # Temporarily ingnored from flutter-tizen.
193203
- unnecessary_new
194204
- unnecessary_null_aware_assignments
195205
- unnecessary_null_aware_operator_on_extension_on_nullable
@@ -204,12 +214,13 @@ linter:
204214
- unnecessary_string_interpolations
205215
- unnecessary_this
206216
- unnecessary_to_list_in_spreads
217+
- unreachable_from_main
207218
- unrelated_type_equality_checks
208219
- unsafe_html
209220
- use_build_context_synchronously
210-
# - use_colored_box # not yet tested
211-
# - use_decorated_box # not yet tested
212-
# - use_enums # not yet tested
221+
# - use_colored_box # Temporarily ingnored from flutter-tizen.
222+
# - use_decorated_box # leads to bugs: DecoratedBox and Container are not equivalent (Container inserts extra padding)
223+
# - use_enums # Temporarily ingnored from flutter-tizen.
213224
- use_full_hex_values_for_flutter_colors
214225
- use_function_type_syntax_for_parameters
215226
- use_if_null_to_convert_nulls_to_bools
@@ -221,6 +232,7 @@ linter:
221232
- use_rethrow_when_possible
222233
- use_setters_to_change_properties
223234
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
235+
# - use_string_in_part_of_directives # Temporarily ingnored from flutter-tizen.
224236
- use_super_parameters
225237
- use_test_throws_matchers
226238
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review

packages/messageport/example/integration_test/messageport_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void main() {
2626

2727
testWidgets('Create remote port', (WidgetTester tester) async {
2828
final LocalPort localPort = await LocalPort.create(kTestPort);
29-
localPort.register((dynamic message, [RemotePort? remotePort]) => null);
29+
localPort.register((dynamic message, [RemotePort? remotePort]) {});
3030

3131
final RemotePort remotePort =
3232
await RemotePort.connect(kTestAppId, kTestPort);
@@ -40,7 +40,7 @@ void main() {
4040
(WidgetTester tester) async {
4141
final LocalPort localPort =
4242
await LocalPort.create(kTestPort, trusted: false);
43-
localPort.register((dynamic message, [RemotePort? remotePort]) => null);
43+
localPort.register((dynamic message, [RemotePort? remotePort]) {});
4444

4545
await expectLater(
4646
() => RemotePort.connect(kTestAppId, kTestPort),
@@ -52,7 +52,7 @@ void main() {
5252

5353
testWidgets('Check for remote', (WidgetTester tester) async {
5454
final LocalPort localPort = await LocalPort.create(kTestPort);
55-
localPort.register((dynamic message, [RemotePort? remotePort]) => null);
55+
localPort.register((dynamic message, [RemotePort? remotePort]) {});
5656

5757
final RemotePort remotePort =
5858
await RemotePort.connect(kTestAppId, kTestPort);

packages/messageport/lib/messageport_tizen.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ MessagePortManager _manager = MessagePortManager();
1111
/// Called when a message is received on message port.
1212
///
1313
/// This is used by [LocalPort.register].
14-
typedef OnMessageReceived = Function(dynamic message, [RemotePort? remotePort]);
14+
typedef OnMessageReceived = void Function(dynamic message,
15+
[RemotePort? remotePort]);
1516

1617
/// Local message port for receiving messages.
1718
class LocalPort {

packages/video_player_avplay/example/lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ class _GetVideoTrackButton extends StatelessWidget {
632632
if (videotracks == null) {
633633
return;
634634
}
635-
await showDialog(
635+
await showDialog<void>(
636636
context: context,
637637
builder: (BuildContext context) {
638638
return AlertDialog(
@@ -676,7 +676,7 @@ class _GetAudioTrackButton extends StatelessWidget {
676676
if (audioTracks == null) {
677677
return;
678678
}
679-
await showDialog(
679+
await showDialog<void>(
680680
context: context,
681681
builder: (BuildContext context) {
682682
return AlertDialog(
@@ -720,7 +720,7 @@ class _GetTextTrackButton extends StatelessWidget {
720720
if (textTracks == null) {
721721
return;
722722
}
723-
await showDialog(
723+
await showDialog<void>(
724724
context: context,
725725
builder: (BuildContext context) {
726726
return AlertDialog(

packages/video_player_videohole/example/lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ class _GetVideoTrackButton extends StatelessWidget {
567567
if (videotracks == null) {
568568
return;
569569
}
570-
await showDialog(
570+
await showDialog<void>(
571571
context: context,
572572
builder: (BuildContext context) {
573573
return AlertDialog(
@@ -611,7 +611,7 @@ class _GetAudioTrackButton extends StatelessWidget {
611611
if (audioTracks == null) {
612612
return;
613613
}
614-
await showDialog(
614+
await showDialog<void>(
615615
context: context,
616616
builder: (BuildContext context) {
617617
return AlertDialog(
@@ -655,7 +655,7 @@ class _GetTextTrackButton extends StatelessWidget {
655655
if (textTracks == null) {
656656
return;
657657
}
658-
await showDialog(
658+
await showDialog<void>(
659659
context: context,
660660
builder: (BuildContext context) {
661661
return AlertDialog(

0 commit comments

Comments
 (0)