linter: Remove NodeLintRule from the hierarchy
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Id3c495ecd4b929114ee65be8e920cd5277d5291d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369524
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart
index 979755c..ccb9385 100644
--- a/pkg/analyzer/lib/src/lint/linter.dart
+++ b/pkg/analyzer/lib/src/lint/linter.dart
@@ -242,7 +242,7 @@
}
/// Describes a lint rule.
-abstract class LintRule implements Comparable<LintRule>, NodeLintRule {
+abstract class LintRule implements Comparable<LintRule> {
/// Used to report lint warnings.
/// NOTE: this is set by the framework before any node processors start
/// visiting nodes.
@@ -321,7 +321,10 @@
/// Lint errors are reported via this [Linter]'s error [reporter].
PubspecVisitor? getPubspecVisitor() => null;
- @override
+ /// Registers node processors in the given [registry].
+ ///
+ /// The node processors may use the provided [context] to access information
+ /// that is not available from the AST nodes or their associated elements.
void registerNodeProcessors(
NodeLintRegistry registry, LinterContext context) {}
@@ -385,17 +388,6 @@
}
}
-/// [LintRule]s that implement this interface want to process only some types
-/// of AST nodes, and will register their processors in the registry.
-abstract class NodeLintRule {
- /// This method is invoked to let the [LintRule] register node processors
- /// in the given [registry].
- ///
- /// The node processors may use the provided [context] to access information
- /// that is not available from the AST nodes or their associated elements.
- void registerNodeProcessors(NodeLintRegistry registry, LinterContext context);
-}
-
class PrintingReporter implements Reporter {
final void Function(String msg) _print;
diff --git a/pkg/linter/lib/src/analyzer.dart b/pkg/linter/lib/src/analyzer.dart
index cd3b240..fdfbf11 100644
--- a/pkg/linter/lib/src/analyzer.dart
+++ b/pkg/linter/lib/src/analyzer.dart
@@ -28,7 +28,6 @@
LinterContext,
LinterOptions,
NodeLintRegistry,
- NodeLintRule,
State;
export 'package:analyzer/src/lint/pub.dart' show PSEntry, PubspecVisitor;
export 'package:analyzer/src/lint/util.dart' show FileSpelunker;
diff --git a/pkg/linter/lib/src/rules/enable_null_safety.dart b/pkg/linter/lib/src/rules/enable_null_safety.dart
index 27ecfca..38dddc4 100644
--- a/pkg/linter/lib/src/rules/enable_null_safety.dart
+++ b/pkg/linter/lib/src/rules/enable_null_safety.dart
@@ -26,7 +26,7 @@
''';
-class EnableNullSafety extends LintRule implements NodeLintRule {
+class EnableNullSafety extends LintRule {
static const LintCode code = LintCode(
'enable_null_safety', 'Use sound null safety.',
correctionMessage: