-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysis_options.yaml
More file actions
98 lines (92 loc) · 4.04 KB
/
Copy pathanalysis_options.yaml
File metadata and controls
98 lines (92 loc) · 4.04 KB
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
# analysis_options.yaml
analyzer:
exclude:
# Self-contained nested Flutter app with its own pubspec/analysis_options;
# analyzed independently, not as part of this package.
- example/**
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# --- 🛡️ Safety, Typing, and Reliability ---
# Requires explicit type specification everywhere (local variables, fields, functions, etc.).
- always_specify_types
# Enforces the use of the @override annotation.
- annotate_overrides
# Avoids method calls on dynamic types to reduce runtime error risk.
- avoid_dynamic_calls
# Avoids returning null from void functions.
- avoid_returning_null_for_void
# Requires handling or explicit ignoring of Future results.
- unawaited_futures
# Recommends using rethrow to preserve the original stack trace when rethrowing an exception.
- use_rethrow_when_possible
# --- 🚀 Performance and Const ---
# Recommends using const constructors when possible.
- prefer_const_constructors
# Recommends using const declarations when possible.
- prefer_const_declarations
# Recommends using final for local variables that aren't reassigned.
- prefer_final_locals
# Recommends using final for variables in for-each loops.
- prefer_final_in_for_each
# Avoids redundant const keywords.
- unnecessary_const
# Avoids unnecessary await in return statements (e.g., return await future;).
- unnecessary_await_in_return
# --- ✨ Conciseness and Null Safety ---
# Recommends using the ?? operator over a verbose ternary operator for null checks (e.g., a ?? b).
- prefer_if_null_operators
# Recommends using the compact this.fieldName syntax for constructor field initialization.
- prefer_initializing_formals
# Recommends using string interpolation ($) instead of the + operator for string concatenation.
- prefer_interpolation_to_compose_strings
# Recommends using the is! operator instead of !is.
- prefer_is_not_operator
# Recommends null-aware method calls (?. ).
- prefer_null_aware_method_calls
# Recommends null-aware operators (??, ?. ).
- prefer_null_aware_operators
# Recommends list.isEmpty over list.length == 0.
- prefer_is_empty
# Recommends using the modern super parameter syntax.
- use_super_parameters
# --- 🗑️ Redundancy and Cleanup ---
# Avoids redundant initialization with = null.
- avoid_init_to_null
# Discourages the use of print() outside of debugging.
- avoid_print
# Avoids empty catch blocks (exceptions should not be silently ignored).
- empty_catches
# Avoids unnecessary this. prefix.
- unnecessary_this
# Avoids unnecessary overrides that just call the super method.
- unnecessary_overrides
# Avoids redundant ? on final variable declarations.
- unnecessary_nullable_for_final_variable_declarations
# Avoids redundant nulls in null-aware operators (e.g., a ?? null).
- unnecessary_null_in_if_null_operators
# Avoids unnecessary string interpolations (e.g., '${variable}' when '$variable' suffices).
- unnecessary_string_interpolations
# --- ✍️ Style and Readability ---
# Requires trailing commas in collections (lists, argument lists, etc.).
- require_trailing_commas
# Requires documentation comments (///) for public members.
- public_member_api_docs
# Recommends SCREAMING_SNAKE_CASE for constant identifiers.
- constant_identifier_names
# Avoids renaming parameters when implementing abstract methods or interfaces.
- avoid_renaming_method_parameters
# Recommends regular function declarations over function variables.
- prefer_function_declarations_over_variables
# Recommends the use of single quotes.
- prefer_single_quotes
# Recommends placing constructors first in a class definition.
- sort_constructors_first
# Recommends using the modern function type syntax for parameters.
- use_function_type_syntax_for_parameters