e774227a81
Bug: https://github.com/dart-lang/sdk/issues/41651 Change-Id: I0a165aef2b5d5cd2f97e5728bb6011a8eb70d9a5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222041 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
53 lines
1.7 KiB
Dart
53 lines
1.7 KiB
Dart
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:analysis_server/src/services/correction/fix_internal.dart';
|
|
import 'package:analyzer/error/error.dart';
|
|
|
|
import 'parse_utils.dart';
|
|
|
|
/// Print diagnostic bulk-fix info.
|
|
Future<void> main() async {
|
|
var overrideDetails = await BulkFixDetails().collectOverrides();
|
|
|
|
print('diagnostics w/ correction producers:\n');
|
|
|
|
var hintEntries = FixProcessor.nonLintProducerMap.entries.where((e) =>
|
|
e.key.type == ErrorType.HINT || e.key.type == ErrorType.STATIC_WARNING);
|
|
|
|
var diagnostics = [
|
|
...hintEntries,
|
|
...FixProcessor.lintProducerMap.entries,
|
|
];
|
|
for (var diagnostic in diagnostics) {
|
|
var canBeAppliedInBulk = false;
|
|
var missingExplanations = <String>[];
|
|
var hasOverride = false;
|
|
for (var generator in diagnostic.value) {
|
|
var producer = generator();
|
|
if (!producer.canBeAppliedInBulk) {
|
|
var producerName = producer.runtimeType.toString();
|
|
if (overrideDetails.containsKey(producerName)) {
|
|
hasOverride = true;
|
|
var override = overrideDetails[producerName];
|
|
var hasComment = override!.hasComment;
|
|
if (!hasComment) {
|
|
missingExplanations.add(producerName);
|
|
}
|
|
}
|
|
} else {
|
|
canBeAppliedInBulk = true;
|
|
}
|
|
}
|
|
|
|
print('${diagnostic.key} bulk fixable: $canBeAppliedInBulk');
|
|
if (!canBeAppliedInBulk && !hasOverride) {
|
|
print(' => override missing');
|
|
}
|
|
for (var producer in missingExplanations) {
|
|
print(' => override explanation missing for: $producer');
|
|
}
|
|
}
|
|
}
|