-
Notifications
You must be signed in to change notification settings - Fork 0
/
analysis_options.yaml
111 lines (104 loc) · 3.51 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
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
include: package:lints/recommended.yaml
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
language:
strict-raw-types: true
strict-casts: true
errors:
invalid_annotation_target: ignore # for freezed
missing_required_param: warning
missing_return: warning
package_api_docs: warning
public_member_api_docs: warning
prefer_interpolation_to_compose_strings: warning
unnecessary_lambdas: warning
avoid_catches_without_on_clauses: warning
avoid_catching_errors: warning
prefer_mixin: warning
use_setters_to_change_properties: warning
avoid_setters_without_getters: warning
type_annotate_public_apis: warning
always_declare_return_types: warning
avoid_void_async: warning
only_throw_errors: warning
prefer_final_locals: warning
prefer_null_aware_method_calls: warning
unawaited_futures: warning
depend_on_referenced_packages: warning
flutter_style_todos: info
deprecated_member_use_from_same_package: info
todo: ignore
# Rules in addition to recommended set
linter:
rules:
- directives_ordering
- package_api_docs
- public_member_api_docs
- comment_references
- prefer_interpolation_to_compose_strings
- unnecessary_lambdas
- lines_longer_than_80_chars
- avoid_catches_without_on_clauses # no pokémon exception handling (at least only catch Exception)
- avoid_catching_errors
- use_to_and_as_if_applicable # this rule may cause false positives, if so, just disable it
- prefer_mixin
- use_setters_to_change_properties
- avoid_setters_without_getters # use a method instead
- avoid_returning_this # use cascades instead
- type_annotate_public_apis
- avoid_types_on_closure_parameters
- avoid_positional_boolean_parameters
- avoid_dynamic_calls
- avoid_returning_null_for_future
- avoid_slow_async_io
- cancel_subscriptions
- close_sinks
- always_declare_return_types
- avoid_void_async
- cascade_invocations
- eol_at_end_of_file
- flutter_style_todos
- leading_newlines_in_multiline_strings
- only_throw_errors
- prefer_final_locals
- prefer_null_aware_method_calls
- unawaited_futures
- unnecessary_null_aware_assignments
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- depend_on_referenced_packages
dart_code_metrics:
anti-patterns:
- long-method
- long-parameter-list
metrics:
cyclomatic-complexity: 20
maximum-nesting-level: 5
number-of-parameters: 4
source-lines-of-code: 50
metrics-exclude:
- test/**
rules:
- avoid-nested-conditional-expressions:
- acceptable-level: 2
- avoid-throw-in-catch-block # throwWithStackTrace should be used instead
- avoid-unnecessary-type-casts
- no-boolean-literal-compare
- no-empty-block
- no-equal-then-else
- no-magic-number:
- allowed: [3.14, -1, 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 100]
- prefer-correct-type-name