[analyzer/linter] Deprecate LintRule.details to avoid new usages

Change-Id: I3d03d5f06901e0a548020522387e8984507a7f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
Parker Lougheed
2024-09-13 18:13:26 +00:00
committed by Commit Queue
parent cb4aedd2ea
commit 4819bd09aa
5 changed files with 10 additions and 3 deletions
@@ -106,7 +106,7 @@ class _LintRuleProducer extends Producer {
for (var rule in Registry.ruleRegistry.rules) {
// TODO(pq): consider suggesting internal lints if editing an SDK options file
if (!rule.state.isInternal) {
yield identifier(rule.name, docComplete: rule.details);
yield identifier(rule.name, docComplete: rule.description);
}
}
}
@@ -150,7 +150,7 @@ linter:
var completion = assertSuggestion('annotate_overrides');
expect(
completion.docComplete,
contains('**DO** annotate overridden methods and fields'),
contains('Annotate overridden members.'),
);
}
+5 -1
View File
@@ -195,6 +195,10 @@ abstract class LintRule {
/// Description (in markdown format) suitable for display in a detailed lint
/// description.
///
/// This property is deprecated and will be removed in a future release.
@Deprecated('Use .description for a short description and consider placing '
'long-form documentation on an external website.')
final String details;
/// Short description suitable for display in console output.
@@ -213,7 +217,7 @@ abstract class LintRule {
required this.name,
this.categories = const <String>{},
required this.description,
required this.details,
this.details = '',
State? state,
}) : state = state ?? State.stable();
@@ -2,6 +2,8 @@
// 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.
// ignore_for_file: deprecated_member_use
import 'package:analyzer/src/lint/registry.dart';
import 'package:test/test.dart';
+1
View File
@@ -85,6 +85,7 @@ Future<String> getMachineListing(
],
'fixStatus':
fixStatusMap[rule.lintCodes.first.uniqueName] ?? 'unregistered',
// ignore: deprecated_member_use
'details': rule.details,
if (sinceInfo != null)
'sinceDartSdk': sinceInfo[rule.name]?.sinceDartSdk ?? 'Unreleased',