Skip to content

Commit c1eafe7

Browse files
committed
Update analysis_options
1 parent 1ba1741 commit c1eafe7

File tree

1 file changed

+79
-65
lines changed

1 file changed

+79
-65
lines changed

analysis_options.yaml

Lines changed: 79 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,152 @@
11
analyzer:
22
strong-mode:
33
implicit-casts: false
4-
# implicit-dynamic: false
5-
# errors:
6-
# todo: warning
4+
implicit-dynamic: false
5+
errors:
6+
# treat missing required parameters as a warning (not a hint)
7+
missing_required_param: warning
8+
# treat missing returns as a warning (not a hint)
9+
missing_return: warning
10+
todo: warning
11+
# Ignore analyzer hints for updating pubspecs when using Future or
12+
# Stream and not importing dart:async
13+
# Please see https://github.com/flutter/flutter/pull/24528 for details.
14+
sdk_version_async_exported_from_core: ignore
715
exclude:
816
- lib/l10n/messages_*.dart
9-
- lib/generated/**
1017
- ios/**
11-
1218
linter:
1319
rules:
1420
- always_declare_return_types
1521
- always_put_control_body_on_new_line
16-
# - always_put_required_named_parameters_first
22+
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
1723
- always_require_non_null_named_parameters
1824
# - always_specify_types
1925
- annotate_overrides
20-
- avoid_annotating_with_dynamic
26+
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
2127
# - avoid_as
22-
# - avoid_bool_literals_in_conditional_expressions under review (see 1068)
23-
- avoid_catches_without_on_clauses
24-
- avoid_catching_errors
28+
- avoid_bool_literals_in_conditional_expressions # not yet tested
29+
- avoid_catches_without_on_clauses # we do this commonly
30+
- avoid_catching_errors # we do this commonly
2531
- avoid_classes_with_only_static_members
26-
# - avoid_double_and_int_checks under review (see 1068)
32+
- avoid_double_and_int_checks # only useful when targeting JS runtime
2733
- avoid_empty_else
28-
# - avoid_field_initializers_in_const_classes under review (see 1068)
34+
- avoid_field_initializers_in_const_classes
2935
- avoid_function_literals_in_foreach_calls
30-
- avoid_implementing_value_types
36+
- avoid_implementing_value_types # not yet tested
3137
- avoid_init_to_null
32-
# - avoid_js_rounded_ints under review (see 1068)
38+
- avoid_js_rounded_ints # only useful when targeting JS runtime
3339
- avoid_null_checks_in_equality_operators
34-
- avoid_positional_boolean_parameters
35-
# - avoid_private_typedef_functions under review (see 1068)
36-
# - avoid_relative_lib_imports under review (see 1068)
37-
# - avoid_renaming_method_parameters under review (see 1068)
40+
- avoid_positional_boolean_parameters # not yet tested
41+
- avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
42+
- avoid_relative_lib_imports
43+
- avoid_renaming_method_parameters
3844
- avoid_return_types_on_setters
39-
- avoid_returning_null
40-
- avoid_returning_this
41-
- avoid_setters_without_getters
42-
# - avoid_single_cascade_in_expression_statements under review (see 1068)
45+
- avoid_returning_null # there are plenty of valid reasons to return null
46+
- avoid_returning_null_for_future # not yet tested
47+
- avoid_returning_null_for_void
48+
- avoid_returning_this # there are plenty of valid reasons to return this
49+
- avoid_setters_without_getters # not yet tested
50+
- avoid_shadowing_type_parameters # not yet tested
51+
- avoid_single_cascade_in_expression_statements # not yet tested
4352
- avoid_slow_async_io
44-
# - avoid_types_as_parameter_names under review (see 1068)
45-
- avoid_types_on_closure_parameters
46-
# - avoid_unused_constructor_parameters under review (see 1068)
47-
# - avoid_void_async under review (see 1068)
53+
- avoid_types_as_parameter_names
54+
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
55+
- avoid_unused_constructor_parameters
56+
# - avoid_void_async
4857
- await_only_futures
4958
- camel_case_types
5059
- cancel_subscriptions
51-
- cascade_invocations
52-
- close_sinks
53-
- comment_references
54-
- constant_identifier_names
60+
- cascade_invocations # not yet tested
61+
- close_sinks # not reliable enough
62+
- comment_references # blocked on https://github.com/flutter/flutter/issues/20765
63+
- constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
5564
- control_flow_in_finally
56-
# - curly_braces_in_flow_control_structures under review (see 1068)
65+
- curly_braces_in_flow_control_structures # not yet tested
5766
- directives_ordering
5867
- empty_catches
5968
- empty_constructor_bodies
6069
- empty_statements
61-
# - file_names under review (see 1068)
70+
- file_names # not yet tested
71+
- flutter_style_todos
6272
- hash_and_equals
6373
- implementation_imports
64-
- invariant_booleans
74+
- invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
6575
- iterable_contains_unrelated_type
66-
- join_return_with_assignment
76+
- join_return_with_assignment # not yet tested
6777
- library_names
6878
- library_prefixes
69-
# - lines_longer_than_80_chars under review (see 1068)
79+
- lines_longer_than_80_chars # not yet tested
7080
- list_remove_unrelated_type
71-
- literal_only_boolean_expressions
81+
- literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
7282
- no_adjacent_strings_in_list
7383
- no_duplicate_case_values
7484
- non_constant_identifier_names
75-
# - null_closures under review (see 1068)
76-
- omit_local_variable_types
77-
# - one_member_abstracts
78-
- only_throw_errors
85+
- null_closures # not yet tested
86+
- omit_local_variable_types # opposite of always_specify_types
87+
- one_member_abstracts # too many false positives
88+
- only_throw_errors # https://github.com/flutter/flutter/issues/5792
7989
- overridden_fields
8090
- package_api_docs
8191
- package_names
8292
- package_prefixed_library_names
83-
- parameter_assignments
93+
- parameter_assignments # we do this commonly
8494
- prefer_adjacent_string_concatenation
8595
- prefer_asserts_in_initializer_lists
8696
- prefer_collection_literals
8797
- prefer_conditional_assignment
8898
- prefer_const_constructors
8999
- prefer_const_constructors_in_immutables
90-
# - prefer_const_declarations under review (see 1068)
91-
# - prefer_const_literals_to_create_immutables under review (see 1068)
92-
- prefer_constructors_over_static_methods
100+
- prefer_const_declarations
101+
- prefer_const_literals_to_create_immutables
102+
- prefer_constructors_over_static_methods # not yet tested
93103
- prefer_contains
94104
- prefer_equal_for_default_values
95-
# - prefer_expression_function_bodies
105+
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
96106
- prefer_final_fields
97107
- prefer_final_locals
98108
- prefer_foreach
99-
- prefer_function_declarations_over_variables
100-
# - prefer_generic_function_type_aliases under review (see 1068)
109+
- prefer_function_declarations_over_variables # not yet tested
110+
- prefer_generic_function_type_aliases
101111
- prefer_initializing_formals
102-
- prefer_interpolation_to_compose_strings
112+
- prefer_int_literals # not yet tested
113+
- prefer_interpolation_to_compose_strings # not yet tested
103114
- prefer_is_empty
104115
- prefer_is_not_empty
105116
- prefer_iterable_whereType
106-
- prefer_mixin
117+
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
118+
- prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
107119
- prefer_single_quotes
108-
# - prefer_typing_uninitialized_variables under review (see 1068)
109-
# - prefer_void_to_null under review (see 1068)
110-
- prefer_int_literals
111-
# - public_member_api_docs
120+
- prefer_typing_uninitialized_variables
121+
- prefer_void_to_null
122+
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
112123
- recursive_getters
113124
- slash_for_doc_comments
114-
# - sort_constructors_first
125+
- sort_constructors_first
126+
- sort_pub_dependencies
115127
- sort_unnamed_constructors_first
116128
- test_types_in_equals
117129
- throw_in_finally
118-
# - type_annotate_public_apis
130+
- type_annotate_public_apis # subset of always_specify_types
119131
- type_init_formals
120-
- unawaited_futures
132+
- unawaited_futures # too many false positives
133+
- unnecessary_await_in_return # not yet tested
121134
- unnecessary_brace_in_string_interps
122-
# - unnecessary_const under review (see 1068)
135+
- unnecessary_const
123136
- unnecessary_getters_setters
124-
- unnecessary_lambdas
125-
# - unnecessary_new under review (see 1068)
137+
- unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
138+
- unnecessary_new
126139
- unnecessary_null_aware_assignments
127140
- unnecessary_null_in_if_null_operators
128141
- unnecessary_overrides
129-
# - unnecessary_parenthesis under review (see 1068)
130-
# - unnecessary_statements under review (see 1068)
142+
- unnecessary_parenthesis
143+
- unnecessary_statements
131144
- unnecessary_this
132145
- unrelated_type_equality_checks
146+
- use_function_type_syntax_for_parameters # not yet tested
133147
- use_rethrow_when_possible
134-
- use_setters_to_change_properties
135-
- use_string_buffers
136-
- use_to_and_as_if_applicable
148+
- use_setters_to_change_properties # not yet tested
149+
- use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
150+
- use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
137151
- valid_regexps
138-
# - void_checks under review (see 1068)
152+
- void_checks # not yet tested

0 commit comments

Comments
 (0)