Skip to content

Commit b310567

Browse files
srawlinsCommit Queue
authored andcommitted
DAS: Use Iterable.any instead of .where->.isNotEmpty
Change-Id: Id5f0c4ed6e37334302103e7a87aaf829552612c1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415740 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Auto-Submit: Samuel Rawlins <[email protected]>
1 parent 77986bd commit b310567

File tree

2 files changed

+27
-33
lines changed

2 files changed

+27
-33
lines changed

pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -506,34 +506,31 @@ class NoProducerOverlapsTest {
506506
// action accidentally executing data-driven fixes.
507507

508508
var dataDrivenCodes = <String>{};
509-
var bulkFixCodes = registeredFixGenerators.lintProducers.entries
509+
var bulkFixForLintCodes = registeredFixGenerators.lintProducers.entries
510510
.where(
511-
(e) =>
512-
e.value
513-
.where(
514-
(generator) =>
515-
generator(
516-
context: StubCorrectionProducerContext.instance,
517-
).canBeAppliedAcrossFiles,
518-
)
519-
.isNotEmpty,
511+
(e) => e.value.any(
512+
(generator) =>
513+
generator(
514+
context: StubCorrectionProducerContext.instance,
515+
).canBeAppliedAcrossFiles,
516+
),
520517
)
521518
.map((e) => e.key);
519+
var bulkFixForNonLintCodes = registeredFixGenerators
520+
.nonLintProducers
521+
.entries
522+
.where(
523+
(e) => e.value.any(
524+
(generator) =>
525+
generator(
526+
context: StubCorrectionProducerContext.instance,
527+
).canBeAppliedAcrossFiles,
528+
),
529+
)
530+
.map((e) => e.key.uniqueName);
522531
var nonDataDrivenCodes = {
523-
...bulkFixCodes,
524-
...registeredFixGenerators.nonLintProducers.entries
525-
.where(
526-
(e) =>
527-
e.value
528-
.where(
529-
(generator) =>
530-
generator(
531-
context: StubCorrectionProducerContext.instance,
532-
).canBeAppliedAcrossFiles,
533-
)
534-
.isNotEmpty,
535-
)
536-
.map((e) => e.key.uniqueName),
532+
...bulkFixForLintCodes,
533+
...bulkFixForNonLintCodes,
537534
};
538535

539536
for (var MapEntry(key: code, value: generators)

pkg/analysis_server/tool/bulk_fix/supported_lints.dart

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ import 'package:analysis_server_plugin/src/correction/fix_generators.dart';
1010
void main() {
1111
var bulkFixCodes = registeredFixGenerators.lintProducers.entries
1212
.where(
13-
(e) =>
14-
e.value
15-
.where(
16-
(generator) =>
17-
generator(
18-
context: StubCorrectionProducerContext.instance,
19-
).canBeAppliedAcrossFiles,
20-
)
21-
.isNotEmpty,
13+
(e) => e.value.any(
14+
(generator) =>
15+
generator(
16+
context: StubCorrectionProducerContext.instance,
17+
).canBeAppliedAcrossFiles,
18+
),
2219
)
2320
.map((e) => e.key);
2421
print(' # bulk-fixable lints');

0 commit comments

Comments
 (0)