Skip to content

Commit c184f9b

Browse files
Use same analysis_options.yaml as devtools. (#544)
1 parent b247dc5 commit c184f9b

File tree

1 file changed

+136
-2
lines changed

1 file changed

+136
-2
lines changed
Lines changed: 136 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,136 @@
1-
# Use the same analysis options that we use in package:devtools
2-
include: package:devtools/analysis_options.yaml
1+
# Start with a base-line of the package:pedantic lints.
2+
include: package:pedantic/analysis_options.yaml
3+
4+
analyzer:
5+
# strong-mode:
6+
# implicit-casts: false
7+
errors:
8+
# treat missing required parameters as a warning (not a hint)
9+
missing_required_param: warning
10+
# treat missing returns as a warning (not a hint)
11+
missing_return: warning
12+
exclude:
13+
- build/**
14+
15+
linter:
16+
rules:
17+
# Added on top of the flutter/flutter lints:
18+
- prefer_generic_function_type_aliases
19+
20+
# From flutter/flutter:
21+
# these rules are documented on and in the same order as
22+
# the Dart Lint rules page to make maintenance easier
23+
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
24+
- always_declare_return_types
25+
# - always_put_control_body_on_new_line
26+
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
27+
- always_require_non_null_named_parameters
28+
# - always_specify_types
29+
- annotate_overrides
30+
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
31+
# - avoid_as # we use 'as' in this codebase
32+
# - avoid_bool_literals_in_conditional_expressions # not yet tested
33+
# - avoid_catches_without_on_clauses # we do this commonly
34+
# - avoid_catching_errors # we do this commonly
35+
- avoid_classes_with_only_static_members
36+
# - avoid_double_and_int_checks # only useful when targeting JS runtime
37+
- avoid_empty_else
38+
- avoid_field_initializers_in_const_classes
39+
- avoid_function_literals_in_foreach_calls
40+
- avoid_init_to_null
41+
# - avoid_js_rounded_ints # only useful when targeting JS runtime
42+
- avoid_null_checks_in_equality_operators
43+
# - avoid_positional_boolean_parameters # not yet tested
44+
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
45+
- avoid_relative_lib_imports
46+
- avoid_renaming_method_parameters
47+
- avoid_return_types_on_setters
48+
# - avoid_returning_null # we do this commonly
49+
# - avoid_returning_this # https://github.com/dart-lang/linter/issues/842
50+
# - avoid_setters_without_getters # not yet tested
51+
# - avoid_single_cascade_in_expression_statements # not yet tested
52+
- avoid_slow_async_io
53+
# - avoid_types_as_parameter_names # https://github.com/dart-lang/linter/pull/954/files
54+
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
55+
# - avoid_unused_constructor_parameters # https://github.com/dart-lang/linter/pull/847
56+
- await_only_futures
57+
- camel_case_types
58+
- cancel_subscriptions
59+
# - cascade_invocations # not yet tested
60+
# - close_sinks # https://github.com/flutter/flutter/issues/5789
61+
# - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
62+
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
63+
- control_flow_in_finally
64+
- directives_ordering
65+
- empty_catches
66+
- empty_constructor_bodies
67+
- empty_statements
68+
- hash_and_equals
69+
- implementation_imports
70+
# - invariant_booleans # https://github.com/flutter/flutter/issues/5790
71+
- iterable_contains_unrelated_type
72+
# - join_return_with_assignment # not yet tested
73+
- library_names
74+
- library_prefixes
75+
- list_remove_unrelated_type
76+
# - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
77+
- no_adjacent_strings_in_list
78+
- no_duplicate_case_values
79+
- non_constant_identifier_names
80+
# - omit_local_variable_types # opposite of always_specify_types
81+
# - one_member_abstracts # too many false positives
82+
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
83+
- overridden_fields
84+
- package_api_docs
85+
- package_names
86+
- package_prefixed_library_names
87+
# - parameter_assignments # we do this commonly
88+
- prefer_adjacent_string_concatenation
89+
- prefer_asserts_in_initializer_lists
90+
- prefer_collection_literals
91+
- prefer_conditional_assignment
92+
- prefer_const_constructors
93+
- prefer_const_constructors_in_immutables
94+
- prefer_const_declarations
95+
- prefer_const_literals_to_create_immutables
96+
# - prefer_constructors_over_static_methods # not yet tested
97+
- prefer_contains
98+
- prefer_equal_for_default_values
99+
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
100+
- prefer_final_fields
101+
- prefer_final_locals
102+
- prefer_foreach
103+
# - prefer_function_declarations_over_variables # not yet tested
104+
- prefer_initializing_formals
105+
# - prefer_interpolation_to_compose_strings # not yet tested
106+
# - prefer_iterable_whereType # https://github.com/dart-lang/sdk/issues/32463
107+
- prefer_is_empty
108+
- prefer_is_not_empty
109+
- prefer_single_quotes
110+
- prefer_typing_uninitialized_variables
111+
- recursive_getters
112+
- slash_for_doc_comments
113+
- sort_constructors_first
114+
- sort_unnamed_constructors_first
115+
- test_types_in_equals
116+
- throw_in_finally
117+
# - type_annotate_public_apis # subset of always_specify_types
118+
- type_init_formals
119+
- unawaited_futures
120+
- unnecessary_brace_in_string_interps
121+
- unnecessary_const
122+
- unnecessary_getters_setters
123+
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
124+
- unnecessary_null_aware_assignments
125+
- unnecessary_null_in_if_null_operators
126+
- unnecessary_overrides
127+
- unnecessary_parenthesis
128+
- unnecessary_statements
129+
- unnecessary_this
130+
- unrelated_type_equality_checks
131+
- use_rethrow_when_possible
132+
# - use_setters_to_change_properties # not yet tested
133+
# - use_string_buffers # https://github.com/dart-lang/linter/pull/664
134+
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
135+
- valid_regexps
136+
# - void_checks # not yet tested

0 commit comments

Comments
 (0)