forked from albertodev01/fraction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalysis_options.yaml
462 lines (325 loc) · 14.1 KB
/
analysis_options.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
analyzer:
errors:
todo: info
include_file_not_found: ignore
exclude:
- example/**
linter:
rules:
# Prevents accidental return type changes which results in a breaking API
# change. Enforcing return type makes API changes visible in a diff.
- always_declare_return_types
# Don't put the statement part of an if, for, while, do on the same line as
# the expression, even if it is short. Doing so makes it unclear that there
# is relevant code there. This is especially important for early returns.
- always_put_control_body_on_new_line
# All non nullable named parameters should be and annotated with @required.
- always_require_non_null_named_parameters
# Protect against unintentionally overriding superclass members
- annotate_overrides
# Highlights boolean expressions which can be simplified
- avoid_bool_literals_in_conditional_expressions
# Errors aren't for catching but to prevent prior to runtime
- avoid_catching_errors
# Can usually be replaced with an extension
- avoid_classes_with_only_static_members
# Only useful when targeting JS. Kept in case it comes into play with
# Flutter Web.
- avoid_double_and_int_checks
# Prevents accidental empty else cases.
- avoid_empty_else
# Use different quotes instead of escaping
- avoid_escaping_inner_quotes
# Prevents unnecessary allocation of a field
- avoid_field_initializers_in_const_classes
# Prevents allocating a lambda and allows return/break/continue control
# flow statements inside the loop
- avoid_function_literals_in_foreach_calls
# Don't break value types by implementing them
- avoid_implementing_value_types
# Removes redundant `= null;`
- avoid_init_to_null
# Null checks aren't required in ==() operators
- avoid_null_checks_in_equality_operators
# Good APIs don't use ambiguous boolean parameters. Instead use named
# parameters
- avoid_positional_boolean_parameters
# Don't call print in production code
- avoid_print
# Always prefer function references over typedefs.
# Jumping twice in code to see the signature of a lambda sucks.
# This is different from the flutter analysis_options
- avoid_private_typedef_functions
# Don't explicitly set defaults
- avoid_redundant_argument_values
# package or relative? Let's end the discussion and use package everywhere
- avoid_relative_lib_imports
# Setters always return void, therefore defining void is redundant
- avoid_return_types_on_setters
# Don't use `Future?`, therefore never return null instead of a Future.
- avoid_returning_null_for_future
# Use empty returns, don't show off with you knowledge about dart internals
- avoid_returning_null_for_void
# Prevents logical inconsistencies. It's good practice to define getters for
# all existing setters.
- avoid_setters_without_getters
# Don't reuse a type parameter when on with the same name already exists in
# the same scope
- avoid_shadowing_type_parameters
# A single cascade operator can be replaced with a normal method call
- avoid_single_cascade_in_expression_statements
# Don't use a parameter names which can be confused with a types
- avoid_types_as_parameter_names
# Containers without parameters have no effect and can be removed
- avoid_unnecessary_containers
# Unused parameters should be removed
- avoid_unused_constructor_parameters
# For async functions use `Future<void>` as return value, not `void`
# This allows usage of the await keyword and prevents operations from
# running in parallel.
- avoid_void_async
# Flutter mobile only: Web packages aren't available in mobile flutter apps
# https://dart-lang.github.io/linter/lints/avoid_web_libraries_in_flutter.html
- avoid_web_libraries_in_flutter
# Use the await keyword only for futures. There is nothing to await in
# synchronous code
- await_only_futures
# Follow the style guide and use UpperCamelCase for extensions
- camel_case_extensions
# Follow the style guide and use UpperCamelCase for class names and typedefs
- camel_case_types
# Prevents leaks and code executing after their lifecycle.
- cancel_subscriptions
# Follow standard dart naming style.
- constant_identifier_names
# Prevents hard to debug code
- control_flow_in_finally
# Single line `if`s are fine, but when a new line splits the bool expression
# and body curly braces are recommended. It prevents the danging else
# problem and easily allows the addition of more lines inside the if body
- curly_braces_in_flow_control_structures
# Follows dart style. Fully supported by IDEs and no manual effort for a
# consistent style
- directives_ordering
# String.fromEnvironment looks up env variables at compile time. The
# variable is baked in by the compiler and can't be changed by environment
# variables.
- do_not_use_environment
# Add a comment why no further error handling is required
- empty_catches
# Removed empty constructor bodies
- empty_constructor_bodies
# Don't allow empty if bodies. Works together with
# curly_braces_in_flow_control_structures
- empty_statements
# Enums aren't powerful enough, now enum like classes get the same linting
# support
- exhaustive_cases
# Follow dart file naming schema
- file_names
# hashCode and equals need to be consistent. One can't live without another.
- hash_and_equals
# DON'T import implementation files from another package.
- implementation_imports
# Although there are some false positives, this lint generally catches
# unnecessary checks.
- invariant_booleans
# Type check for Iterable<T>.contains(other) where other is! T
# otherwise contains will always report false. Those errors are usually very
# hard to catch.
- iterable_contains_unrelated_type
# Hint to join return and assignment
- join_return_with_assignment
# Makes sure a library name is a valid dart identifier
- library_names
# Follow dart style
- library_prefixes
# Type check for List<T>.remove(item) where item is! T. The list can't
# contain item. Those errors are not directly obvious especially when
# refactoring.
- list_remove_unrelated_type
# Good for libraries to prevent unnecessary code paths.
# False positives may occur for applications when boolean properties are
# generated by external programs producing auto-generated source code
#
# Known issue: while(true) loops https://github.com/dart-lang/linter/issues/453
- literal_only_boolean_expressions
# Don't forget the whitespaces at the end
- missing_whitespace_between_adjacent_strings
# Concat Strings obviously with `+` inside a list.
- no_adjacent_strings_in_list
# Second case is basically dead code which will never be reached.
- no_duplicate_case_values
# Flutter only: `createState` shouldn't pass information into the state
- no_logic_in_create_state
# calling `runtimeType` may be a performance problem
- no_runtimeType_toString
# Follow dart style naming conventions
- non_constant_identifier_names
# Might become irrelevant when non-nullable types land in dart. Until then
# use this lint check which checks for non null arguments for specific dart
# sdk methods.
- null_closures
# Defining interfaces (abstract classes), with only one method, makes sense
# architecture wise.
# Discussion: https://github.com/passsy/dart-lint/issues/2
- one_member_abstracts
# Highlights unintentionally overridden fields.
- overridden_fields
# Only relevant for packages, not applications or general dart code
- package_api_docs
# Follow dart style package naming convention
- package_names
# Seems very rare, especially for applications.
- package_prefixed_library_names
# Most likely a mistake, if not: bad practice
- parameter_assignments
# Makes it easier to migrate to const constructors and to have final fields
- prefer_asserts_in_initializer_lists
# Assertions blocks don't require a message because they throw simple to
# understand errors
- prefer_asserts_with_message
# Collection literals are shorter. They exists, use them.
- prefer_collection_literals
# Use the ??= operator when possible
- prefer_conditional_assignment
# Always use const when possible, make runtime faster
- prefer_const_constructors
# Add a const constructor when possible
- prefer_const_constructors_in_immutables
# final is good, const is better
- prefer_const_declarations
# Always use const when possible, make runtime faster
- prefer_const_literals_to_create_immutables
# Dart has named constructors. Static methods in other languages (java) are
# a workaround which don't have named constructors.
- prefer_constructors_over_static_methods
# Contains may be faster and is easier to read
- prefer_contains
# Prevent confusion with call-side when using named parameters
- prefer_equal_for_default_values
# Avoid accidental reassignments and allows the compiler to do optimizations
- prefer_final_fields
# Helps avoid accidental reassignments and allows the compiler to do
# optimizations.
- prefer_final_in_for_each
# Helps avoid accidental reassignments and allows the compiler to do
# optimizations.
- prefer_final_locals
# Dense code isn't necessarily better code. But it's nice.
- prefer_foreach
# Saves lot of code
- prefer_for_elements_to_map_fromIterable
# As Dart allows local function declarations, it is a good practice to use
# them in the place of function literals.
- prefer_function_declarations_over_variables
# For consistency
- prefer_generic_function_type_aliases
# Allows potential usage of const
- prefer_if_elements_to_conditional_expressions
# Dart has a special operator for this, use it
- prefer_if_null_operators
# Terser code
- prefer_initializing_formals
# Easier move towards const, and way easier to read
- prefer_inlined_adds
# Interpolate, use less "", '' and +
- prefer_interpolation_to_compose_strings
# Iterables do not necessary know their length
- prefer_is_empty
# Easier to read
- prefer_is_not_empty
# Use the `foo is! Foo` instead of `!(foo is Foo)`
- prefer_is_not_operator
# Easier to read
- prefer_iterable_whereType
# Makes expressions with null checks easier to read
- prefer_null_aware_operators
# Use whatever makes you happy. noexcuse doesn't define a style
- prefer_single_quotes
# Allows potential usage of const
- prefer_spread_collections
# Define types
- prefer_typing_uninitialized_variables
# Null is not a type, use void
- prefer_void_to_null
# Document the replacement API
- provide_deprecation_message
# Definitely not a rule for standard dart code. Maybe relevant for packages
# It's relevant here.
- public_member_api_docs
# Hints accidental recursions
- recursive_getters
# Flutter only, prefer SizedBox over Container which offers a
# const constructors
- sized_box_for_whitespace
# Follow dart style use triple slashes
- slash_for_doc_comments
# Flutter only, always put child last
- sort_child_properties_last
# Any sorting is better than no sorting
- sort_pub_dependencies
# Default constructor comes first
- sort_unnamed_constructors_first
# First test, then cast
- test_types_in_equals
# Hard to debug and bad style
- throw_in_finally
# Type annotations make the compiler intelligent, use them
- type_annotate_public_apis
# Don't add types for already typed constructor parameters
- type_init_formals
# Remove async/await clutter when not required
- unnecessary_await_in_return
# Remove unnecessary braces
- unnecessary_brace_in_string_interps
# Yes, const everywhere. But not in an already const scope.
- unnecessary_const
# Getter/setters can be added later on in a non API breaking manner
- unnecessary_getters_setters
# Remove the optional `new` keyword
- unnecessary_new
# Don't assign `null` when value is already `null`
- unnecessary_null_aware_assignments
# Don't assign `null` when value is already `null`
- unnecessary_null_in_if_null_operators
# If a variable doesn't change and is initialized, no need to define it as
# nullable (NNDB)
- unnecessary_nullable_for_final_variable_declarations
# Remove overrides which simply call super
- unnecessary_overrides
# Remove clutter where possible
- unnecessary_parenthesis
# Use raw string only when needed
- unnecessary_raw_strings
# Avoid magic overloads of + operators
- unnecessary_statements
# Remove unnecessary escape characters
- unnecessary_string_escapes
# Especially with NNBD a no-brainer
- unnecessary_string_interpolations
# The variable is clear, remove clutter
- unnecessary_this
# Highlights potential bugs where unrelated types are compared with another
- unrelated_type_equality_checks
# Web only
- unsafe_html
# The use of intValue.isOdd/isEven to check for evenness.
- use_is_even_rather_than_modulo
# Always use hex syntax Color(0x00000001), never Color(1)
- use_full_hex_values_for_flutter_colors
# Always use generic function type syntax, don't mix styles
- use_function_type_syntax_for_parameters
# Still unsure if `late` is always better than `!` (NNBD)
- use_late_for_private_fields_and_variables
# Use rethrow to preserve the original stacktrace
- use_rethrow_when_possible
# Use the setter syntax
- use_setters_to_change_properties
# In most cases, using a string buffer is preferred for composing strings
# due to its improved performance
- use_string_buffers
# Catches invalid regular expressions
- valid_regexps
# Don't assign anything to void
- void_checks