Skip to content

Commit df45313

Browse files
FMorschelCommit Queue
authored andcommitted
[Linter] Fixes no_literal_bool_comparisons scope and CONVERT_TO_BOOL_EXPRESSION fix
Fixes: #60614 Change-Id: I8c880d16c21f35a096c3d9def08c0588ae17a40d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442440 Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Auto-Submit: Felipe Morschel <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 4564d14 commit df45313

File tree

5 files changed

+166
-217
lines changed

5 files changed

+166
-217
lines changed

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,10 +1874,7 @@ LintCode.annotate_redeclares:
18741874
LintCode.avoid_annotating_with_dynamic:
18751875
status: hasFix
18761876
LintCode.avoid_bool_literals_in_conditional_expressions:
1877-
status: needsFix
1878-
notes: |-
1879-
Each expression like `condition ? true : boolExpression` can be universally
1880-
fixed to not contain a bool literal.
1877+
status: hasFix
18811878
LintCode.avoid_catches_without_on_clauses:
18821879
status: noFix
18831880
notes: |-

pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ final _builtInLintGenerators = <LintCode, List<ProducerGenerator>>{
286286
LinterLintCode.annotate_overrides: [AddOverride.new],
287287
LinterLintCode.annotate_redeclares: [AddRedeclare.new],
288288
LinterLintCode.avoid_annotating_with_dynamic: [RemoveTypeAnnotation.other],
289+
LinterLintCode.avoid_bool_literals_in_conditional_expressions: [
290+
ConvertToBooleanExpression.new,
291+
],
289292
LinterLintCode.avoid_empty_else: [RemoveEmptyElse.new],
290293
LinterLintCode.avoid_escaping_inner_quotes: [ConvertQuotes.new],
291294
LinterLintCode.avoid_function_literals_in_foreach_calls: [

0 commit comments

Comments
 (0)