Skip to content

Commit

Permalink
[analyzer/linter] Deprecate LintRule.details to avoid new usages
Browse files Browse the repository at this point in the history
Change-Id: I3d03d5f06901e0a548020522387e8984507a7f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384940
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Brian Wilkerson <[email protected]>
Reviewed-by: Phil Quitslund <[email protected]>
  • Loading branch information
parlough authored and Commit Queue committed Sep 13, 2024
1 parent cb4aedd commit 4819bd0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ linter:
var completion = assertSuggestion('annotate_overrides');
expect(
completion.docComplete,
contains('**DO** annotate overridden methods and fields'),
contains('Annotate overridden members.'),
);
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/analyzer/lib/src/lint/linter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();

Expand Down
2 changes: 2 additions & 0 deletions pkg/linter/test/validate_rule_description_format_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
1 change: 1 addition & 0 deletions pkg/linter/tool/machine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 4819bd0

Please sign in to comment.