Skip to content

Commit 44c80e9

Browse files
committed
Fix formatting
1 parent f8f4f76 commit 44c80e9

File tree

44 files changed

+233
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+233
-211
lines changed

lib/src/common/parameters/excluded_identifiers_list_parameter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class ExcludedIdentifiersListParameter {
4545
) {
4646
final excludeList =
4747
json[ExcludedIdentifiersListParameter.excludeParameterName]
48-
as Iterable? ??
49-
[];
48+
as Iterable? ??
49+
[];
5050

5151
return ExcludedIdentifiersListParameter.fromJson(
5252
excludeList: excludeList,

lib/src/lints/avoid_debug_print_in_release/avoid_debug_print_in_release_rule.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,10 @@ your `debugPrint` call in a `!kReleaseMode` check.""",
172172
}
173173

174174
bool _isNotReleaseCheck(Expression node) {
175-
if (node.childEntities.toList()
176-
case [
177-
final Token token,
178-
final Identifier identifier,
179-
]) {
175+
if (node.childEntities.toList() case [
176+
final Token token,
177+
final Identifier identifier,
178+
]) {
180179
return token.type == TokenType.BANG &&
181180
_isReleaseModeIdentifier(identifier);
182181
}

lib/src/lints/avoid_final_with_getter/visitors/avoid_final_with_getter_visitor.dart

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ class AvoidFinalWithGetterVisitor extends RecursiveAstVisitor<void> {
1313

1414
@override
1515
void visitMethodDeclaration(MethodDeclaration node) {
16-
if (node
17-
case MethodDeclaration(
18-
isGetter: true,
19-
declaredFragment: ExecutableFragment(
20-
element: ExecutableElement(
21-
isAbstract: false,
22-
isPublic: true,
23-
),
24-
),
25-
)) {
16+
if (node case MethodDeclaration(
17+
isGetter: true,
18+
declaredFragment: ExecutableFragment(
19+
element: ExecutableElement(
20+
isAbstract: false,
21+
isPublic: true,
22+
),
23+
),
24+
)) {
2625
final visitor = GetterVariableVisitor(node);
2726
node.parent?.accept(visitor);
2827

lib/src/lints/avoid_final_with_getter/visitors/getter_variable_visitor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class GetterVariableVisitor extends RecursiveAstVisitor<void> {
1010

1111
/// Creates a new instance of [GetterVariableVisitor]
1212
GetterVariableVisitor(MethodDeclaration getter)
13-
: _getterId = getter.getterReferenceId;
13+
: _getterId = getter.getterReferenceId;
1414

1515
/// Is there a variable associated with the getter
1616
VariableDeclaration? get variable => _variable;

lib/src/lints/avoid_late_keyword/avoid_late_keyword_rule.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class AvoidLateKeywordRule extends SolidLintRule<AvoidLateKeywordParameters> {
6161
configs: configs,
6262
name: lintName,
6363
paramsParser: AvoidLateKeywordParameters.fromJson,
64-
problemMessage: (_) => 'Avoid using the "late" keyword. '
64+
problemMessage: (_) =>
65+
'Avoid using the "late" keyword. '
6566
'It may result in runtime exceptions.',
6667
);
6768

lib/src/lints/avoid_late_keyword/models/avoid_late_keyword_parameters.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class AvoidLateKeywordParameters {
3737
factory AvoidLateKeywordParameters.fromJson(Map<String, Object?> json) =>
3838
AvoidLateKeywordParameters(
3939
allowInitialized: json['allow_initialized'] as bool? ?? false,
40-
ignoredTypes:
41-
List<String>.from(json['ignored_types'] as Iterable? ?? []),
40+
ignoredTypes: List<String>.from(
41+
json['ignored_types'] as Iterable? ?? [],
42+
),
4243
);
4344
}

lib/src/lints/avoid_non_null_assertion/avoid_non_null_assertion_rule.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class AvoidNonNullAssertionRule extends SolidLintRule {
5050
final rule = RuleConfig(
5151
configs: configs,
5252
name: lintName,
53-
problemMessage: (_) => 'Avoid using the bang operator. '
53+
problemMessage: (_) =>
54+
'Avoid using the bang operator. '
5455
'It may result in runtime exceptions.',
5556
);
5657

@@ -77,7 +78,8 @@ class AvoidNonNullAssertionRule extends SolidLintRule {
7778
if (operand is IndexExpression) {
7879
final type = operand.target?.staticType;
7980
final isInterface = type is InterfaceType;
80-
final isMap = isInterface &&
81+
final isMap =
82+
isInterface &&
8183
(type.isDartCoreMap ||
8284
type.allSupertypes.any((v) => v.isDartCoreMap));
8385

lib/src/lints/avoid_returning_widgets/avoid_returning_widgets_rule.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class AvoidReturningWidgetsRule
6565
configs: configs,
6666
name: lintName,
6767
paramsParser: AvoidReturningWidgetsParameters.fromJson,
68-
problemMessage: (_) => 'Returning a widget from a function is considered '
68+
problemMessage: (_) =>
69+
'Returning a widget from a function is considered '
6970
'an anti-pattern. Unless you are overriding an existing method, '
7071
'consider extracting your widget to a separate class.',
7172
);
@@ -84,8 +85,7 @@ class AvoidReturningWidgetsRule
8485
// simultaneously checks if return type is [DartType]
8586
final DartType? returnType = switch (node) {
8687
FunctionDeclaration(returnType: TypeAnnotation(:final type?)) ||
87-
MethodDeclaration(returnType: TypeAnnotation(:final type?)) =>
88-
type,
88+
MethodDeclaration(returnType: TypeAnnotation(:final type?)) => type,
8989
_ => null,
9090
};
9191

@@ -101,11 +101,11 @@ class AvoidReturningWidgetsRule
101101
FunctionDeclaration(:final functionExpression) =>
102102
functionExpression.parent is MethodDeclaration &&
103103
(functionExpression.parent! as MethodDeclaration).metadata.any(
104-
(m) => m.name.name == _override,
105-
),
104+
(m) => m.name.name == _override,
105+
),
106106
MethodDeclaration(:final metadata) => metadata.any(
107-
(m) => m.name.name == _override,
108-
),
107+
(m) => m.name.name == _override,
108+
),
109109
_ => false,
110110
};
111111

lib/src/lints/avoid_unnecessary_setstate/avoid_unnecessary_set_state_rule.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class AvoidUnnecessarySetStateRule extends SolidLintRule {
6868
final rule = RuleConfig(
6969
name: lintName,
7070
configs: configs,
71-
problemMessage: (_) => 'Avoid calling unnecessary setState. '
71+
problemMessage: (_) =>
72+
'Avoid calling unnecessary setState. '
7273
'Consider changing the state directly.',
7374
);
7475
return AvoidUnnecessarySetStateRule._(rule);

lib/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_visitor.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ class AvoidUnnecessarySetStateVisitor extends RecursiveAstVisitor<void> {
5151
}
5252

5353
final methods = node.members.whereType<MethodDeclaration>();
54-
final classMethodsNames =
55-
methods.map((declaration) => declaration.name.lexeme).toSet();
54+
final classMethodsNames = methods
55+
.map((declaration) => declaration.name.lexeme)
56+
.toSet();
5657
final methodBodies = methods.map((declaration) => declaration.body).toSet();
5758

5859
final checkedMethods = methods.where(_isMethodChecked);
@@ -105,8 +106,10 @@ class AvoidUnnecessarySetStateVisitor extends RecursiveAstVisitor<void> {
105106
return true;
106107
}
107108

108-
final visitor =
109-
AvoidUnnecessarySetStateMethodVisitor(classMethodsNames, bodies);
109+
final visitor = AvoidUnnecessarySetStateMethodVisitor(
110+
classMethodsNames,
111+
bodies,
112+
);
110113
declaration.visitChildren(visitor);
111114

112115
final hasSetState = visitor.setStateInvocations.isNotEmpty;

0 commit comments

Comments
 (0)