-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanalysis_options.yaml
165 lines (155 loc) · 5 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
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
- prefer_single_quotes
- cancel_subscriptions
- close_sinks
- eol_at_end_of_file
- sized_box_for_whitespace
- avoid_unnecessary_containers
- avoid_print
- parameter_assignments
- avoid_relative_lib_imports
- always_use_package_imports
- avoid_empty_else
- always_declare_return_types
- avoid_void_async
- prefer_void_to_null
- use_key_in_widget_constructors
- prefer_null_aware_method_calls
- unnecessary_await_in_return
- prefer_final_locals
- prefer_final_in_for_each
- constant_identifier_names
analyzer:
plugins:
- dart_code_metrics
errors:
prefer_single_quotes: error
cancel_subscriptions: error
close_sinks: error
eol_at_end_of_file: error
sized_box_for_whitespace: error
avoid_unnecessary_containers: error
dead_code: error
duplicate_import: error
avoid_print: error
parameter_assignments: error
avoid_relative_lib_imports: error
always_use_package_imports: error
avoid_empty_else: error
always_declare_return_types: error
avoid_void_async: error
prefer_void_to_null: error
use_key_in_widget_constructors: error
exclude:
- "**/*.g.dart"
- "**/*.gr.dart"
- "**/*.freezed.dart"
- "**/*.config.dart"
- "**/generated/**"
- "**/main_reusable_widgets.dart"
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
dart_code_metrics:
metrics-exclude:
- test/**
# For clarification please visit: https://dartcodemetrics.dev/docs/rules/overview
rules:
# Common Dart rules
- avoid-dynamic
- avoid-global-state:
severity: error
- avoid-missing-enum-constant-in-map:
severity: error
- avoid-nested-conditional-expressions:
acceptable-level: 2
severity: error
- avoid-throw-in-catch-block
- avoid-unrelated-type-assertions
- avoid-unused-parameters
- avoid-nested-conditional-expressions:
acceptable-level: 2
- avoid-redundant-async
- avoid-throw-in-catch-block
- avoid-unnecessary-conditionals
- avoid-unnecessary-type-casts
- ban-name:
entries:
- ident: l
description: Please use failure instead
- ident: r
description: Please use some more descriptive name for success
severity: error
- binary-expression-operand-order
- member-ordering:
order:
- public-fields
- private-fields
- constructors
- public-methods
- private-methods
widgets-order:
- init-state-method
- did-change-dependencies-method
- did-update-widget-method
- dispose-method
- build-method
- no-boolean-literal-compare
- no-equal-then-else:
severity: error
- no-object-declaration
- prefer-correct-identifier-length:
min-identifier-length: 2
exceptions: ["i"]
severity: error
- prefer-correct-test-file-name
- prefer-correct-type-name:
min-length: 3
severity: error
- prefer-first
- prefer-immediate-return
- prefer-iterable-of
- prefer-last
- prefer-match-file-name:
exclude:
- "**/main.dart"
- prefer-trailing-comma:
break-on: 4
# Flutter rules
- always-remove-listener
- avoid-border-all
- avoid-returning-widgets
- avoid-unnecessary-setstate
- avoid-wrapping-in-padding
- prefer-const-border-radius
- prefer-correct-edge-insets-constructor
- prefer-single-widget-per-file:
ignore-private-widgets: true
- use-setstate-synchronously
# For clarification please visit: https://dartcodemetrics.dev/docs/metrics/overview
metrics:
cyclomatic-complexity: 3
source-lines-of-code: 10
number-of-parameters: 4
maximum-nesting-level: 3
number-of-methods: 7