Skip to content

Commit f157394

Browse files
Clean up abstract classes that only contain static methods (#9170)
* Clean up abstract classes that only contain static methods * remove unused parameter
1 parent ca2cdfb commit f157394

28 files changed

+65
-81
lines changed

packages/devtools_app/lib/src/framework/framework_core.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ typedef ErrorReporter = void Function(String title, Object error);
4444

4545
final _log = Logger('framework_core');
4646

47-
// ignore: avoid_classes_with_only_static_members, intentional grouping of static methods.
48-
abstract class FrameworkCore {
47+
/// A namespace for core framework objects and methods.
48+
extension FrameworkCore on Never {
4949
static final _memoryObserver = MemoryObserver();
5050

5151
/// Initializes the DevTools framework, which includes setting up global

packages/devtools_app/lib/src/screens/debugger/debugger_model.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ class StackFrameAndSourcePosition {
236236
}
237237
}
238238

239-
// ignore: avoid_classes_with_only_static_members, fine for utility method.
240-
abstract class ScriptRefUtils {
239+
/// A namespace for [ScriptRef] utilities.
240+
extension ScriptRefUtils on Never {
241241
static String fileName(ScriptRef scriptRef) =>
242242
fileNameFromUri(Uri.parse(scriptRef.uri!).path)!;
243243
}

packages/devtools_app/lib/src/screens/debugger/span_parser.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import 'package:collection/collection.dart';
99
import 'package:string_scanner/string_scanner.dart';
1010

1111
//TODO(jacobr): cleanup.
12-
// ignore: avoid_classes_with_only_static_members
13-
abstract class SpanParser {
12+
/// A namespace for [SpanParser] utilities.
13+
extension SpanParser on Never {
1414
/// Takes a TextMate [Grammar] and a [String] and outputs a list of
1515
/// [ScopeSpan]s corresponding to the parsed input.
1616
static List<ScopeSpan> parse(Grammar grammar, String src) {

packages/devtools_app/lib/src/screens/memory/panes/chart/controller/charts/android_chart_controller.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import '../../../../../../shared/charts/chart_trace.dart'
1313
import '../../../../shared/primitives/memory_timeline.dart';
1414
import '../../data/charts.dart';
1515

16-
// ignore: avoid_classes_with_only_static_members, enum-like classes are ok
17-
class _Color {
16+
/// A namespace for Android memory chart color constants.
17+
extension _Color on Never {
1818
static const otherColor = Color(0xffff8800); // HoloOrangeDark;
1919
static const nativeHeapColor = Color(0xff33b5e5); // HoloBlueLight
2020
static final graphicColor = Colors.greenAccent.shade400;

packages/devtools_app/lib/src/screens/memory/panes/chart/controller/charts/vm_chart_controller.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import '../../../../../../shared/charts/chart_trace.dart'
1313
import '../../../../shared/primitives/memory_timeline.dart';
1414
import '../../data/charts.dart';
1515

16-
// ignore: avoid_classes_with_only_static_members, enum-like classes are ok
17-
class _Colors {
16+
/// A namespace for VM memory chart color constants.
17+
extension _Colors on Never {
1818
static final capacity = Colors.grey[400]!;
1919
static const used = Color(0xff33b5e5);
2020
static const externals = Color(0xff4ddeff);

packages/devtools_app/lib/src/shared/analytics/constants/_property_editor_sidebar_constants.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
part of '../constants.dart';
66

7-
// ignore: avoid_classes_with_only_static_members, used for namespacing.
8-
class PropertyEditorSidebar {
7+
/// A namespace for Property Editor analytics.
8+
extension PropertyEditorSidebar on Never {
99
/// Analytics id to track events that come from the DTD editor sidebar.
1010
static String get id => 'propertyEditorSidebar';
1111

packages/devtools_app/lib/src/shared/analytics/gtags.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import 'analytics.dart' as ga;
2121
external void _gTagCommandName(String command, String name, [JSObject? params]);
2222

2323
// TODO(jacobr): refactor this code if we do not migrate off gtags.
24-
// ignore: avoid_classes_with_only_static_members
25-
class GTag {
24+
/// A namespace for gtags.
25+
extension GTag on Never {
2626
static const _event = 'event';
2727
static const _exception = 'exception';
2828

packages/devtools_app/lib/src/shared/charts/flame_chart.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -889,9 +889,8 @@ extension NodeListExtension on List<FlameChartNode> {
889889
}
890890
}
891891

892-
// TODO(jacobr): cleanup up this util class with just static members.
893-
// ignore: avoid_classes_with_only_static_members
894-
class FlameChartUtils {
892+
/// A namespace for flame chart utilities.
893+
extension FlameChartUtils on Never {
895894
static double leftPaddingForNode(
896895
int index,
897896
List<FlameChartNode> nodes, {

packages/devtools_app/lib/src/shared/development_helpers.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ void resetDevToolsExtensionEnabledStates() =>
8484
/// server connection.
8585
final stubExtensionEnabledStates = <String, ExtensionEnabledState>{};
8686

87-
// ignore: avoid_classes_with_only_static_members, useful for testing.
88-
abstract class StubDevToolsExtensions {
87+
/// A namespace for stubbed DevTools extensions.
88+
///
89+
/// These are useful for testing and local development.
90+
extension StubDevToolsExtensions on Never {
8991
/// Extension for package:foo detected from a running app that requires a
9092
/// connected app.
9193
static final fooExtension = DevToolsExtensionConfig.parse({

packages/devtools_app/lib/src/shared/feature_flags.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ const _kNetworkDisconnectExperience = bool.fromEnvironment(
4141
defaultValue: true,
4242
);
4343

44-
// It is ok to have enum-like static only classes.
45-
// ignore: avoid_classes_with_only_static_members
46-
/// Flags to hide features under construction.
44+
/// A namespace for feature flags, which set the visibility of features under
45+
/// active development.
4746
///
4847
/// When adding a new feature flag, the developer is responsible for adding it
4948
/// to the [_allFlags] map for debugging purposes.
50-
abstract class FeatureFlags {
49+
extension FeatureFlags on Never {
5150
/// Flag to enable the DevTools memory observer, which attempts to help users
5251
/// avoid OOM crashes.
5352
///

0 commit comments

Comments
 (0)