1
+ # From the official flutter repo: https://github.com/flutter/flutter/blob/master/analysis_options.yaml
2
+ # partly customized for S3I Flutter
3
+ # see https://dart.dev/guides/language/analysis-options for more information
4
+
5
+ analyzer :
6
+ strong-mode :
7
+ implicit-casts : false
8
+ implicit-dynamic : false
9
+ errors :
10
+ # treat missing required parameters as a error (not a hint)
11
+ missing_required_param : error
12
+ # treat missing returns as a error (not a hint)
13
+ missing_return : error
14
+ # allow having TODOs in the code
15
+ todo : ignore
16
+ # allow self-reference to deprecated members
17
+ deprecated_member_use_from_same_package : info
18
+ unnecessary_null_comparison : warning
19
+ exclude :
20
+ - " bin/cache/**"
21
+ - " dev/conductor/lib/proto/*"
22
+ - " example/**"
23
+
24
+ linter :
25
+ rules :
26
+ - always_declare_return_types
27
+ # - always_put_control_body_on_new_line
28
+ # - always_put_required_named_parameters_first # prefer having parameters in the same order as fields
29
+ - always_require_non_null_named_parameters
30
+ - always_specify_types
31
+ - always_use_package_imports
32
+ - annotate_overrides
33
+ # - avoid_annotating_with_dynamic # conflicts with always_specify_types
34
+ - avoid_bool_literals_in_conditional_expressions
35
+ # - avoid_catches_without_on_clauses # sometimes necessary to convert them to s3i errors
36
+ # - avoid_catching_errors # see avoid_catches_without_on_clauses
37
+ - avoid_classes_with_only_static_members
38
+ - avoid_double_and_int_checks
39
+ - avoid_dynamic_calls
40
+ - avoid_empty_else
41
+ # - avoid_equals_and_hash_code_on_mutable_classes # currently used for the data classes, maybe we should change this later
42
+ - avoid_escaping_inner_quotes
43
+ - avoid_field_initializers_in_const_classes
44
+ - avoid_function_literals_in_foreach_calls
45
+ - avoid_implementing_value_types
46
+ - avoid_init_to_null
47
+ - avoid_js_rounded_ints
48
+ - avoid_null_checks_in_equality_operators
49
+ - avoid_positional_boolean_parameters
50
+ - avoid_print
51
+ # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
52
+ # - avoid_redundant_argument_values # we could do declare arguments with values that match the defaults to highlight this value
53
+ - avoid_relative_lib_imports
54
+ - avoid_renaming_method_parameters
55
+ - avoid_return_types_on_setters
56
+ # - avoid_returning_null # there are plenty of valid reasons to return null
57
+ - avoid_returning_null_for_future
58
+ - avoid_returning_null_for_void
59
+ # - avoid_returning_this # there are plenty of valid reasons to return this
60
+ - avoid_setters_without_getters
61
+ - avoid_shadowing_type_parameters
62
+ - avoid_single_cascade_in_expression_statements
63
+ - avoid_slow_async_io
64
+ - avoid_type_to_string
65
+ - avoid_types_as_parameter_names
66
+ # - avoid_types_on_closure_parameters # conflicts with always_specify_types
67
+ - avoid_unnecessary_containers
68
+ - avoid_unused_constructor_parameters
69
+ - avoid_void_async
70
+ # - avoid_web_libraries_in_flutter # unsure what to do
71
+ - await_only_futures
72
+ - camel_case_extensions
73
+ - camel_case_types
74
+ - cancel_subscriptions
75
+ - cascade_invocations
76
+ - cast_nullable_to_non_nullable
77
+ # - close_sinks # not reliable enough
78
+ # - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
79
+ # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
80
+ - control_flow_in_finally
81
+ # - curly_braces_in_flow_control_structures # not required by flutter style
82
+ - deprecated_consistency
83
+ # - diagnostic_describe_all_properties
84
+ - directives_ordering
85
+ # - do_not_use_environment # we do this commonly
86
+ - empty_catches
87
+ - empty_constructor_bodies
88
+ - empty_statements
89
+ - exhaustive_cases
90
+ - file_names
91
+ - flutter_style_todos
92
+ - hash_and_equals
93
+ - implementation_imports
94
+ # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
95
+ - iterable_contains_unrelated_type
96
+ # - join_return_with_assignment # not required by flutter style
97
+ - leading_newlines_in_multiline_strings
98
+ - library_names
99
+ - library_prefixes
100
+ - lines_longer_than_80_chars
101
+ - list_remove_unrelated_type
102
+ # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
103
+ - missing_whitespace_between_adjacent_strings
104
+ - no_adjacent_strings_in_list
105
+ # - no_default_cases # too many false positives
106
+ - no_duplicate_case_values
107
+ - no_logic_in_create_state
108
+ - no_runtimeType_toString
109
+ - non_constant_identifier_names
110
+ - null_check_on_nullable_type_parameter
111
+ - null_closures
112
+ # - omit_local_variable_types # opposite of always_specify_types
113
+ # - one_member_abstracts # too many false positives
114
+ - only_throw_errors
115
+ - overridden_fields
116
+ - package_api_docs
117
+ - package_names
118
+ - package_prefixed_library_names
119
+ - parameter_assignments
120
+ - prefer_adjacent_string_concatenation
121
+ - prefer_asserts_in_initializer_lists
122
+ # - prefer_asserts_with_message # not required by flutter style
123
+ - prefer_collection_literals
124
+ - prefer_conditional_assignment
125
+ - prefer_const_constructors
126
+ - prefer_const_constructors_in_immutables
127
+ - prefer_const_declarations
128
+ - prefer_const_literals_to_create_immutables
129
+ # - prefer_constructors_over_static_methods # far too many false positives
130
+ - prefer_contains
131
+ # - prefer_double_quotes
132
+ - prefer_equal_for_default_values
133
+ # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
134
+ - prefer_final_fields
135
+ - prefer_final_in_for_each
136
+ - prefer_final_locals
137
+ - prefer_for_elements_to_map_fromIterable
138
+ - prefer_foreach
139
+ - prefer_function_declarations_over_variables
140
+ - prefer_generic_function_type_aliases
141
+ - prefer_if_elements_to_conditional_expressions
142
+ - prefer_if_null_operators
143
+ - prefer_initializing_formals
144
+ - prefer_inlined_adds
145
+ # - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants
146
+ - prefer_interpolation_to_compose_strings
147
+ - prefer_is_empty
148
+ - prefer_is_not_empty
149
+ - prefer_is_not_operator
150
+ - prefer_iterable_whereType
151
+ # - prefer_mixin # https://github.com/dart-lang/language/issues/32
152
+ - prefer_null_aware_operators
153
+ # - prefer_relative_imports # incompatible with sub-package imports
154
+ - prefer_single_quotes
155
+ - prefer_spread_collections
156
+ - prefer_typing_uninitialized_variables
157
+ - prefer_void_to_null
158
+ - provide_deprecation_message
159
+ - public_member_api_docs
160
+ - recursive_getters
161
+ - sized_box_for_whitespace
162
+ - slash_for_doc_comments
163
+ - sort_child_properties_last
164
+ - sort_constructors_first
165
+ - sort_pub_dependencies
166
+ - sort_unnamed_constructors_first
167
+ - test_types_in_equals
168
+ - throw_in_finally
169
+ - tighten_type_of_initializing_formals
170
+ # - type_annotate_public_apis # subset of always_specify_types
171
+ - type_init_formals
172
+ # - unawaited_futures # too many false positives
173
+ - unnecessary_await_in_return
174
+ - unnecessary_brace_in_string_interps
175
+ - unnecessary_const
176
+ # - unnecessary_final # conflicts with prefer_final_locals
177
+ - unnecessary_getters_setters
178
+ # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
179
+ - unnecessary_new
180
+ - unnecessary_null_aware_assignments
181
+ - unnecessary_null_checks
182
+ - unnecessary_null_in_if_null_operators
183
+ - unnecessary_nullable_for_final_variable_declarations
184
+ - unnecessary_overrides
185
+ - unnecessary_parenthesis
186
+ - unnecessary_raw_strings
187
+ - unnecessary_statements
188
+ - unnecessary_string_escapes
189
+ - unnecessary_string_interpolations
190
+ - unnecessary_this
191
+ - unrelated_type_equality_checks
192
+ - unsafe_html
193
+ - use_full_hex_values_for_flutter_colors
194
+ - use_function_type_syntax_for_parameters
195
+ - use_if_null_to_convert_nulls_to_bools
196
+ - use_is_even_rather_than_modulo
197
+ - use_key_in_widget_constructors
198
+ - use_late_for_private_fields_and_variables
199
+ - use_named_constants
200
+ - use_raw_strings
201
+ - use_rethrow_when_possible
202
+ - use_setters_to_change_properties
203
+ # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
204
+ # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
205
+ - valid_regexps
206
+ - void_checks
0 commit comments