Skip to content

Commit d49d1c8

Browse files
authored
chore: apply lints on firebase_admob (#5230)
1 parent 48f7dd7 commit d49d1c8

File tree

11 files changed

+384
-84
lines changed

11 files changed

+384
-84
lines changed
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
2+
# Copyright 2021 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# in the LICENSE file.
5+
6+
linter:
7+
rules:
8+
- always_declare_return_types
9+
- always_put_control_body_on_new_line
10+
- always_put_required_named_parameters_first
11+
- always_require_non_null_named_parameters
12+
- always_specify_types
13+
- always_use_package_imports
14+
- annotate_overrides
15+
- avoid_annotating_with_dynamic
16+
- avoid_as
17+
- avoid_bool_literals_in_conditional_expressions
18+
- avoid_catches_without_on_clauses
19+
- avoid_catching_errors
20+
- avoid_classes_with_only_static_members
21+
- avoid_double_and_int_checks
22+
- avoid_empty_else
23+
- avoid_equals_and_hash_code_on_mutable_classes
24+
- avoid_escaping_inner_quotes
25+
- avoid_field_initializers_in_const_classes
26+
- avoid_function_literals_in_foreach_calls
27+
- avoid_implementing_value_types
28+
- avoid_init_to_null
29+
- avoid_js_rounded_ints
30+
- avoid_null_checks_in_equality_operators
31+
- avoid_positional_boolean_parameters
32+
- avoid_print
33+
- avoid_private_typedef_functions
34+
- avoid_redundant_argument_values
35+
- avoid_relative_lib_imports
36+
- avoid_renaming_method_parameters
37+
- avoid_return_types_on_setters
38+
- avoid_returning_null
39+
- avoid_returning_null_for_future
40+
- avoid_returning_null_for_void
41+
- avoid_returning_this
42+
- avoid_setters_without_getters
43+
- avoid_shadowing_type_parameters
44+
- avoid_single_cascade_in_expression_statements
45+
- avoid_slow_async_io
46+
- avoid_type_to_string
47+
- avoid_types_as_parameter_names
48+
- avoid_types_on_closure_parameters
49+
- avoid_unnecessary_containers
50+
- avoid_unused_constructor_parameters
51+
- avoid_void_async
52+
- avoid_web_libraries_in_flutter
53+
- await_only_futures
54+
- camel_case_extensions
55+
- camel_case_types
56+
- cancel_subscriptions
57+
- cascade_invocations
58+
- cast_nullable_to_non_nullable
59+
- close_sinks
60+
- comment_references
61+
- constant_identifier_names
62+
- control_flow_in_finally
63+
- curly_braces_in_flow_control_structures
64+
- diagnostic_describe_all_properties
65+
- directives_ordering
66+
- do_not_use_environment
67+
- empty_catches
68+
- empty_constructor_bodies
69+
- empty_statements
70+
- exhaustive_cases
71+
- file_names
72+
- flutter_style_todos
73+
- hash_and_equals
74+
- implementation_imports
75+
- invariant_booleans
76+
- iterable_contains_unrelated_type
77+
- join_return_with_assignment
78+
- leading_newlines_in_multiline_strings
79+
- library_names
80+
- library_prefixes
81+
- lines_longer_than_80_chars
82+
- list_remove_unrelated_type
83+
- literal_only_boolean_expressions
84+
- missing_whitespace_between_adjacent_strings
85+
- no_adjacent_strings_in_list
86+
- no_default_cases
87+
- no_duplicate_case_values
88+
- no_logic_in_create_state
89+
- no_runtimeType_toString
90+
- non_constant_identifier_names
91+
- null_check_on_nullable_type_parameter
92+
- null_closures
93+
- omit_local_variable_types
94+
- one_member_abstracts
95+
- only_throw_errors
96+
- overridden_fields
97+
- package_api_docs
98+
- package_names
99+
- package_prefixed_library_names
100+
- parameter_assignments
101+
- prefer_adjacent_string_concatenation
102+
- prefer_asserts_in_initializer_lists
103+
- prefer_asserts_with_message
104+
- prefer_collection_literals
105+
- prefer_conditional_assignment
106+
- prefer_const_constructors
107+
- prefer_const_constructors_in_immutables
108+
- prefer_const_declarations
109+
- prefer_const_literals_to_create_immutables
110+
- prefer_constructors_over_static_methods
111+
- prefer_contains
112+
- prefer_double_quotes
113+
- prefer_equal_for_default_values
114+
- prefer_expression_function_bodies
115+
- prefer_final_fields
116+
- prefer_final_in_for_each
117+
- prefer_final_locals
118+
- prefer_for_elements_to_map_fromIterable
119+
- prefer_foreach
120+
- prefer_function_declarations_over_variables
121+
- prefer_generic_function_type_aliases
122+
- prefer_if_elements_to_conditional_expressions
123+
- prefer_if_null_operators
124+
- prefer_initializing_formals
125+
- prefer_inlined_adds
126+
- prefer_int_literals
127+
- prefer_interpolation_to_compose_strings
128+
- prefer_is_empty
129+
- prefer_is_not_empty
130+
- prefer_is_not_operator
131+
- prefer_iterable_whereType
132+
- prefer_mixin
133+
- prefer_null_aware_operators
134+
- prefer_relative_imports
135+
- prefer_single_quotes
136+
- prefer_spread_collections
137+
- prefer_typing_uninitialized_variables
138+
- prefer_void_to_null
139+
- provide_deprecation_message
140+
- public_member_api_docs
141+
- recursive_getters
142+
- sized_box_for_whitespace
143+
- slash_for_doc_comments
144+
- sort_child_properties_last
145+
- sort_constructors_first
146+
- sort_pub_dependencies
147+
- sort_unnamed_constructors_first
148+
- test_types_in_equals
149+
- throw_in_finally
150+
- tighten_type_of_initializing_formals
151+
- type_annotate_public_apis
152+
- type_init_formals
153+
- unawaited_futures
154+
- unnecessary_await_in_return
155+
- unnecessary_brace_in_string_interps
156+
- unnecessary_const
157+
- unnecessary_final
158+
- unnecessary_getters_setters
159+
- unnecessary_lambdas
160+
- unnecessary_new
161+
- unnecessary_null_aware_assignments
162+
- unnecessary_null_checks
163+
- unnecessary_null_in_if_null_operators
164+
- unnecessary_nullable_for_final_variable_declarations
165+
- unnecessary_overrides
166+
- unnecessary_parenthesis
167+
- unnecessary_raw_strings
168+
- unnecessary_statements
169+
- unnecessary_string_escapes
170+
- unnecessary_string_interpolations
171+
- unnecessary_this
172+
- unrelated_type_equality_checks
173+
- unsafe_html
174+
- use_full_hex_values_for_flutter_colors
175+
- use_function_type_syntax_for_parameters
176+
- use_is_even_rather_than_modulo
177+
- use_key_in_widget_constructors
178+
- use_late_for_private_fields_and_variables
179+
- use_raw_strings
180+
- use_rethrow_when_possible
181+
- use_setters_to_change_properties
182+
- use_string_buffers
183+
- use_to_and_as_if_applicable
184+
- valid_regexps
185+
- void_checks
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Copyright 2021 The Chromium Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# in the LICENSE file.
4+
5+
include: all_lint_rules.yaml
6+
analyzer:
7+
# TODO(rrousselGit): disable implicit-cast/implicit-dynamic
8+
errors:
9+
# Otherwise cause the import of all_lint_rules to warn because of some rules conflicts.
10+
# We explicitly enabled even conflicting rules and are fixing the conflict
11+
# in this file
12+
included_file_warning: ignore
13+
exclude:
14+
- "**/generated_plugin_registrant.dart"
15+
linter:
16+
rules:
17+
## Disabled rules because the repository doesn't respect them (yet)
18+
19+
always_put_control_body_on_new_line: false
20+
comment_references: false
21+
prefer_constructors_over_static_methods: false
22+
prefer_final_fields: false
23+
prefer_final_locals: false
24+
omit_local_variable_types: false
25+
avoid_equals_and_hash_code_on_mutable_classes: false
26+
27+
#############
28+
29+
# Personal preference. I don't find it more readable
30+
cascade_invocations: false
31+
32+
# Conflicts with `prefer_single_quotes`
33+
# Single quotes are easier to type and don't compromise on readability.
34+
prefer_double_quotes: false
35+
36+
# Conflicts with `omit_local_variable_types` and other rules.
37+
# As per Dart guidelines, we want to avoid unnecessary types to make the code
38+
# more readable.
39+
# See https://dart.dev/guides/language/effective-dart/design#avoid-type-annotating-initialized-local-variables
40+
always_specify_types: false
41+
42+
# Incompatible with `prefer_final_locals`
43+
# Having immutable local variables makes larger functions more predictible
44+
# so we will use `prefer_final_locals` instead.
45+
unnecessary_final: false
46+
47+
# Not quite suitable for Flutter, which may have a `build` method with a single
48+
# return, but that return is still complex enough that a "body" is worth it.
49+
prefer_expression_function_bodies: false
50+
51+
# Conflicts with the convention used by flutter, which puts `Key key`
52+
# and `@required Widget child` last.
53+
always_put_required_named_parameters_first: false
54+
55+
# `as` is not that bad (especially with the upcoming non-nullable types).
56+
# Explicit exceptions is better than implicit exceptions.
57+
avoid_as: false
58+
59+
# This project doesn't use Flutter-style todos
60+
flutter_style_todos: false
61+
62+
# There are situations where we voluntarily want to catch everything,
63+
# especially as a library.
64+
avoid_catches_without_on_clauses: false
65+
66+
# Boring as it sometimes force a line of 81 characters to be split in two.
67+
# As long as we try to respect that 80 characters limit, going slightly
68+
# above is fine.
69+
lines_longer_than_80_chars: false
70+
71+
# Conflicts with disabling `implicit-dynamic`
72+
avoid_annotating_with_dynamic: false
73+
74+
# conflicts with `prefer_relative_imports`
75+
always_use_package_imports: false
76+
77+
# Disabled for now until we have NNBD as it otherwise conflicts with `missing_return`
78+
no_default_cases: false
79+
80+
# False positive, null checks don't need a message
81+
prefer_asserts_with_message: false
82+
83+
# Cumbersome with `context.select`
84+
avoid_types_on_closure_parameters: false
85+
86+
# Too many false positive (builders)
87+
diagnostic_describe_all_properties: false
88+
89+
# false positives (setter-like functions)
90+
avoid_positional_boolean_parameters: false
91+
92+
# Does not apply to providers
93+
prefer_const_constructors_in_immutables: false
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2021 The Chromium Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# in the LICENSE file.
4+
5+
include: ../analysis_options.yaml
6+
linter:
7+
rules:
8+
avoid_print: false

0 commit comments

Comments
 (0)