-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalysis_options.yaml
152 lines (144 loc) · 10.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
# 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.
# Additional information about this file can be found at
# Dart Linter: https://dart.dev/guides/language/analysis-options
# Quick fix: https://dart.dev/tools/linter-rules#quick-fixes
# Dart Code Metrics: https://dartcodemetrics.dev/
# Rules
# Linter rules: https://dart.dev/tools/linter-rules
# Dart Code Metrics Rules: https://dartcodemetrics.dev/docs/rules
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- "example/**"
- "build/**"
- "lib/generated_code/**"
- "**/*.freezed.*"
- "**/*.g.*"
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:
# Error rules:
always_use_package_imports: true # Avoid relative imports for files in lib/.
avoid_dynamic_calls: false # Avoid method calls or property accesses on a “dynamic” target.
avoid_returning_null_for_future: true # Avoid returning null for Future.
avoid_type_to_string: true # Avoid .toString() in production code since results may be minified.
cancel_subscriptions: true # Cancel instances of dart.async.StreamSubscription.
close_sinks: true # Close instances of dart.core.Sink.
comment_references: true # Only reference in scope identifiers in doc comments.
diagnostic_describe_all_properties: false # DO reference all public properties in debug methods.
discarded_futures: false # DO Don’t invoke asynchronous functions in non-async blocks.
literal_only_boolean_expressions: true # Boolean expression composed only with literals.
no_adjacent_strings_in_list: true # Don’t use adjacent strings in list.
prefer_relative_imports: false # Prefer relative imports for files in lib/.
test_types_in_equals: true # Test type arguments in operator ==(Object other).
throw_in_finally: true # Avoid throw in finally block.
unnecessary_statements: true # Avoid using unnecessary statements.
unsafe_html: true # Avoid unsafe HTML APIs.
# Style rules:
always_declare_return_types: true # Declare method return types.
always_put_control_body_on_new_line: false # Separate the control structure expression from its statement.
always_put_required_named_parameters_first: false # Put required named parameters first.
always_specify_types: false # Specify type annotations.
avoid_annotating_with_dynamic: true # Avoid annotating with dynamic when not required.
avoid_bool_literals_in_conditional_expressions: true # Avoid bool literals in conditional expressions.
avoid_catches_without_on_clauses: true # Avoid catches without on clauses.
avoid_catching_errors: true # Don’t explicitly catch Error or types that implement it.
avoid_classes_with_only_static_members: true # Avoid defining a class that contains only static members.
avoid_double_and_int_checks: true # Avoid double and int checks.
avoid_equals_and_hash_code_on_mutable_classes: true # Avoid overloading operator == and hashCode on classes not marked @immutable.
avoid_escaping_inner_quotes: true # Avoid escaping inner quotes by converting surrounding quotes.
avoid_field_initializers_in_const_classes: true # Avoid field initializers in const classes.
avoid_final_parameters: true # Avoid final for parameter declarations
avoid_implementing_value_types: true # Don’t implement classes that override ==.
avoid_js_rounded_ints: true # Avoid JavaScript rounded ints.
avoid_positional_boolean_parameters: true # Avoid positional boolean parameters.
avoid_private_typedef_functions: true # Avoid private typedef functions.
avoid_redundant_argument_values: true # Avoid redundant argument values.
avoid_returning_null: true # Avoid returning null from members whose return type is bool, double, int, or num.
avoid_returning_this: true # Avoid returning this from methods just to enable a fluent interface.
avoid_setters_without_getters: true # Avoid setters without getters.
avoid_types_on_closure_parameters: false # Avoid annotating types for function expression parameters.
avoid_unused_constructor_parameters: true # Avoid defining unused parameters in constructors.
avoid_void_async: true # Avoid async functions that return void.
cascade_invocations: true # Cascade consecutive method invocations on the same reference.
cast_nullable_to_non_nullable: true # Don’t cast a nullable value to a non nullable type.
combinators_ordering: true # Sort combinator names alphabetically.
conditional_uri_does_not_exist: true # Missing conditional import.
deprecated_consistency: true # deprecated_consistency
directives_ordering: true # Adhere to Effective Dart Guide directives sorting conventions.
do_not_use_environment: true # Do not use environment declared variables.
eol_at_end_of_file: true # Put a single newline at end of file.
flutter_style_todos: true # Use Flutter TODO format: // TODO(username): message, https://URL-to-issue.
join_return_with_assignment: true # Join return statement with assignment when possible.
leading_newlines_in_multiline_strings: true # Start multiline strings with a newline.
lines_longer_than_80_chars: false # Avoid lines longer than 80 characters.
missing_whitespace_between_adjacent_strings: true # Missing whitespace between adjacent strings.
no_default_cases: false # No default cases.
no_runtimeType_toString: true # Avoid calling toString() on runtimeType.
noop_primitive_operations: true # Noop primitive operations.
omit_local_variable_types: false # Omit type annotations for local variables.
one_member_abstracts: false # Avoid defining a one-member abstract class when a simple function will do.
only_throw_errors: true # Only throw instances of classes extending either Exception or Error.
package_api_docs: false # Provide doc comments for all public APIs.
parameter_assignments: true # Don’t reassign references to parameters of functions or methods.
prefer_asserts_with_message: true # Prefer asserts with message.
prefer_constructors_over_static_methods: true # Prefer defining constructors instead of static methods to create instances.
prefer_double_quotes: false # Prefer double quotes where they won’t require escape sequences.
prefer_expression_function_bodies: true # Use => for short members whose body is a single return statement.
prefer_final_in_for_each: true # Prefer final in for-each loop variable if reference is not reassigned.
prefer_final_locals: true # Prefer final for variable declarations if they are not reassigned.
prefer_final_parameters: false # Prefer final for parameter declarations if they are not reassigned.
prefer_foreach: true # Use forEach to only apply a function to all the elements.
prefer_if_elements_to_conditional_expressions: true # Prefer if elements to conditional expressions where possible.
prefer_int_literals: true # Prefer int literals over double literals.
prefer_mixin: true # Prefer using mixins.
prefer_null_aware_method_calls: true # Prefer null aware method calls.
prefer_single_quotes: true # Only use double quotes for strings containing single quotes.
public_member_api_docs: false # Document all public members.
require_trailing_commas: true # Use trailing commas for all function calls and declarations.
sized_box_shrink_expand: true # Use SizedBox shrink and expand named constructors.
sort_constructors_first: true # Sort constructor declarations before other members.
sort_unnamed_constructors_first: false # Sort constructor declarations before other members.
tighten_type_of_initializing_formals: true # Tighten type of initializing formal.
type_annotate_public_apis: true # Type annotate public APIs.
unawaited_futures: true # Future results in async function bodies must be awaited or marked unawaited using dart:async.
unnecessary_await_in_return: true # Unnecessary await keyword in return.
unnecessary_final: false # Don’t use final for local variables.
unnecessary_lambdas: true # Don’t create a lambda when a tear-off will do.
unnecessary_null_aware_operator_on_extension_on_nullable: true # Unnecessary null aware operator on extension on a nullable type
unnecessary_null_checks: true # Unnecessary null checks.
unnecessary_parenthesis: true # Unnecessary parenthesis can be removed.
unnecessary_raw_strings: true # Unnecessary raw string.
unnecessary_to_list_in_spreads: true # Unnecessary toList() in spreads.
use_colored_box: true # Use ColoredBox.
use_decorated_box: true # Use DecoratedBox.
use_enums: true # Use enums rather than classes that behave like enums.
use_if_null_to_convert_nulls_to_bools: true # Use if-null operators to convert nulls to bools.
use_is_even_rather_than_modulo: true # Prefer intValue.isOdd/isEven instead of checking the result of % 2.
use_late_for_private_fields_and_variables: true # Use late for private members with a non-nullable type.
use_named_constants: true # Use predefined named constants.
use_raw_strings: true # Use raw string to avoid escapes.
use_setters_to_change_properties: true # Use a setter for operations that conceptually change a property.
use_string_buffers: true # Use string buffers to compose strings.
use_super_parameters: true # Use super-initializer parameters where possible.
use_test_throws_matchers: true # Use throwsA matcher instead of fail().
use_to_and_as_if_applicable: true # Start the name of the method with to/_to or as/_as if applicable.
# Pub rules:
sort_pub_dependencies: false # Sort pub dependencies alphabetically.