linter: Remove unused fields in Group

Well, to be honest, remove all instances of Group. Instead, "groups"
are Strings. Because there was only one field left, a Group is just
a... name of a group.

Also, LintRule is no longer Comparable because that does not seem to
have served a purpose...

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I6e058139631dc1b06a4072a2549f156d1622c673
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369782
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart
index 1e9f074..3570b44 100644
--- a/pkg/analyzer/lib/src/lint/linter.dart
+++ b/pkg/analyzer/lib/src/lint/linter.dart
@@ -35,45 +35,16 @@
 export 'package:analyzer/src/lint/state.dart'
     show dart2_12, dart3, dart3_3, State;
 
-class Group implements Comparable<Group> {
-  /// Defined rule groups.
-  static const Group errors =
-      Group._('errors', description: 'Possible coding errors.');
-  static const Group pub = Group._('pub',
-      description: 'Pub-related rules.',
-      link: Hyperlink('See the <strong>Pubspec Format</strong>',
-          'https://dart.dev/tools/pub/pubspec'));
-  static const Group style = Group._('style',
-      description:
-          'Matters of style, largely derived from the official Dart Style Guide.',
-      link: Hyperlink('See the <strong>Style Guide</strong>',
-          'https://dart.dev/guides/language/effective-dart/style'));
+abstract class Group {
+  /// A group representing possible coding errors.
+  static const String errors = 'errors';
 
-  /// List of builtin groups in presentation order.
-  @visibleForTesting
-  static const Iterable<Group> builtin = [errors, style, pub];
+  /// A group representing Pub-related rules.
+  static const String pub = 'pub';
 
-  final String name;
-
-  @visibleForTesting
-  final bool custom;
-
-  final String description;
-
-  final Hyperlink? link;
-
-  factory Group(String name, {String description = '', Hyperlink? link}) {
-    var n = name.toLowerCase();
-    return builtin.firstWhere((g) => g.name == n,
-        orElse: () =>
-            Group._(name, custom: true, description: description, link: link));
-  }
-
-  const Group._(this.name,
-      {this.custom = false, required this.description, this.link});
-
-  @override
-  int compareTo(Group other) => name.compareTo(other.name);
+  /// A group representing matters of style, largely derived from Effective
+  /// Dart.
+  static const String style = 'style';
 }
 
 @visibleForTesting
@@ -229,7 +200,7 @@
 }
 
 /// Describes a lint rule.
-abstract class LintRule implements Comparable<LintRule> {
+abstract class LintRule {
   /// Used to report lint warnings.
   /// NOTE: this is set by the framework before any node processors start
   /// visiting nodes.
@@ -243,7 +214,7 @@
   final String description;
 
   /// Lint group (for example, 'style').
-  final Group group;
+  final String group;
 
   /// Lint name.
   final String name;
@@ -294,15 +265,6 @@
 
   set reporter(ErrorReporter value) => _reporter = value;
 
-  @override
-  int compareTo(LintRule other) {
-    var g = group.compareTo(other.group);
-    if (g != 0) {
-      return g;
-    }
-    return name.compareTo(other.name);
-  }
-
   /// Return a visitor to be passed to pubspecs to perform lint
   /// analysis.
   /// Lint errors are reported via this [Linter]'s error [reporter].
diff --git a/pkg/linter/test/engine_test.dart b/pkg/linter/test/engine_test.dart
index d4b9dda..78eba1b 100644
--- a/pkg/linter/test/engine_test.dart
+++ b/pkg/linter/test/engine_test.dart
@@ -36,20 +36,6 @@
       });
     });
 
-    group('groups', () {
-      test('factory', () {
-        expect(Group('style').custom, isFalse);
-        expect(Group('pub').custom, isFalse);
-        expect(Group('errors').custom, isFalse);
-        expect(Group('Kustom').custom, isTrue);
-      });
-      test('builtins', () {
-        expect(Group.builtin.contains(Group.style), isTrue);
-        expect(Group.builtin.contains(Group.errors), isTrue);
-        expect(Group.builtin.contains(Group.pub), isTrue);
-      });
-    });
-
     group('lint driver', () {
       test('pubspec', () {
         var visited = false;
@@ -82,17 +68,6 @@
               link.html, '<a href="http://dart.dev"><strong>dart</strong></a>');
         });
       });
-
-      group('rule', () {
-        test('comparing', () {
-          LintRule r1 = MockLintRule('Bar', Group('acme'));
-          LintRule r2 = MockLintRule('Foo', Group('acme'));
-          expect(r1.compareTo(r2), -1);
-          LintRule r3 = MockLintRule('Bar', Group('acme'));
-          LintRule r4 = MockLintRule('Bar', Group('woody'));
-          expect(r3.compareTo(r4), -1);
-        });
-      });
     });
   });
 }
@@ -112,11 +87,6 @@
   PubspecVisitor getPubspecVisitor() => MockPubspecVisitor(nodeVisitor);
 }
 
-class MockLintRule extends LintRule {
-  MockLintRule(String name, Group group)
-      : super(name: name, group: group, description: '', details: '');
-}
-
 class MockPubspecVisitor extends PubspecVisitor {
   final NodeVisitor? nodeVisitor;
 
diff --git a/pkg/linter/tool/machine.dart b/pkg/linter/tool/machine.dart
index 3caa0da..48b6650 100644
--- a/pkg/linter/tool/machine.dart
+++ b/pkg/linter/tool/machine.dart
@@ -72,7 +72,7 @@
       {
         'name': rule.name,
         'description': rule.description,
-        'group': rule.group.name,
+        'group': rule.group,
         'state': rule.state.label,
         'incompatible': rule.incompatibleRules,
         'sets': [