Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/devtools_app/lib/src/framework/framework_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ typedef ErrorReporter = void Function(String title, Object error);

final _log = Logger('framework_core');

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

/// Initializes the DevTools framework, which includes setting up global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ class StackFrameAndSourcePosition {
}
}

// ignore: avoid_classes_with_only_static_members, fine for utility method.
abstract class ScriptRefUtils {
/// A namespace for [ScriptRef] utilities.
extension ScriptRefUtils on Never {
static String fileName(ScriptRef scriptRef) =>
fileNameFromUri(Uri.parse(scriptRef.uri!).path)!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'package:collection/collection.dart';
import 'package:string_scanner/string_scanner.dart';

//TODO(jacobr): cleanup.
// ignore: avoid_classes_with_only_static_members
abstract class SpanParser {
/// A namespace for [SpanParser] utilities.
extension SpanParser on Never {
/// Takes a TextMate [Grammar] and a [String] and outputs a list of
/// [ScopeSpan]s corresponding to the parsed input.
static List<ScopeSpan> parse(Grammar grammar, String src) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import '../../../../../../shared/charts/chart_trace.dart'
import '../../../../shared/primitives/memory_timeline.dart';
import '../../data/charts.dart';

// ignore: avoid_classes_with_only_static_members, enum-like classes are ok
class _Color {
/// A namespace for Android memory chart color constants.
extension _Color on Never {
static const otherColor = Color(0xffff8800); // HoloOrangeDark;
static const nativeHeapColor = Color(0xff33b5e5); // HoloBlueLight
static final graphicColor = Colors.greenAccent.shade400;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import '../../../../../../shared/charts/chart_trace.dart'
import '../../../../shared/primitives/memory_timeline.dart';
import '../../data/charts.dart';

// ignore: avoid_classes_with_only_static_members, enum-like classes are ok
class _Colors {
/// A namespace for VM memory chart color constants.
extension _Colors on Never {
static final capacity = Colors.grey[400]!;
static const used = Color(0xff33b5e5);
static const externals = Color(0xff4ddeff);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

part of '../constants.dart';

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

Expand Down
4 changes: 2 additions & 2 deletions packages/devtools_app/lib/src/shared/analytics/gtags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import 'analytics.dart' as ga;
external void _gTagCommandName(String command, String name, [JSObject? params]);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,8 @@ extension NodeListExtension on List<FlameChartNode> {
}
}

// TODO(jacobr): cleanup up this util class with just static members.
// ignore: avoid_classes_with_only_static_members
class FlameChartUtils {
/// A namespace for flame chart utilities.
extension FlameChartUtils on Never {
static double leftPaddingForNode(
int index,
List<FlameChartNode> nodes, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ void resetDevToolsExtensionEnabledStates() =>
/// server connection.
final stubExtensionEnabledStates = <String, ExtensionEnabledState>{};

// ignore: avoid_classes_with_only_static_members, useful for testing.
abstract class StubDevToolsExtensions {
/// A namespace for stubbed DevTools extensions.
///
/// These are useful for testing and local development.
extension StubDevToolsExtensions on Never {
/// Extension for package:foo detected from a running app that requires a
/// connected app.
static final fooExtension = DevToolsExtensionConfig.parse({
Expand Down
7 changes: 3 additions & 4 deletions packages/devtools_app/lib/src/shared/feature_flags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ const _kNetworkDisconnectExperience = bool.fromEnvironment(
defaultValue: true,
);

// It is ok to have enum-like static only classes.
// ignore: avoid_classes_with_only_static_members
/// Flags to hide features under construction.
/// A namespace for feature flags, which set the visibility of features under
/// active development.
///
/// When adding a new feature flag, the developer is responsible for adding it
/// to the [_allFlags] map for debugging purposes.
abstract class FeatureFlags {
extension FeatureFlags on Never {
/// Flag to enable the DevTools memory observer, which attempts to help users
/// avoid OOM crashes.
///
Expand Down
6 changes: 2 additions & 4 deletions packages/devtools_app/lib/src/shared/http/_http_date.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

part of 'http.dart';

// TODO(jacobr): cleanup this class with only static members.
// ignore: avoid_classes_with_only_static_members
/// Utility functions for working with dates with HTTP specific date formats.
class HttpDate {
/// A namespace for HTTP date utilities.
extension HttpDate on Never {
// Parse a cookie date string.
static DateTime _parseCookieDate(String date) {
const monthsLowerCase = const <String>[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import 'package:devtools_app_shared/ui.dart';
import 'package:flutter/material.dart';

// Enum-like static classes are ok.
// ignore: avoid_classes_with_only_static_members
class DiagnosticsTextStyles {
/// A namespace for diagnostic text styles and utilities.
extension DiagnosticsTextStyles on Never {
static TextStyle unimportant(ColorScheme colorScheme) => TextStyle(
color: colorScheme.isLight ? Colors.grey.shade500 : Colors.grey.shade600,
);
Expand Down
1 change: 1 addition & 0 deletions packages/devtools_app/lib/src/shared/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:flutter/widgets.dart';
import 'package:logging/logging.dart';
import 'package:vm_service/vm_service.dart';

// ignore: avoid-importing-entrypoint-exports, required to access version.
import '../../../devtools.dart' as devtools;
import '../../service/connected_app/connected_app.dart';
import '../framework/app_error_handling.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import 'package:devtools_app/src/screens/memory/panes/tracing/tracing_pane_contr
import 'package:flutter_test/flutter_test.dart';
import 'package:vm_service/vm_service.dart';

// ignore: avoid_classes_with_only_static_members, ok for enum-like class
class _Tests {
/// A namespace for memory tracing tests.
extension _Tests on Never {
static final empty = TracePaneController(rootPackage: '');

static final selection = TracePaneController(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import '../scene_test_extensions.dart';
// To run:
// flutter run -t test/test_infra/scenes/memory/default.stager_app.g.dart -d macos

// ignore: avoid_classes_with_only_static_members, enum like classes are ok
abstract class MemoryDefaultSceneHeaps {
/// A namespace for stubbed data used in memory tests.
extension MemoryDefaultSceneHeaps on Never {
/// Many instances of the same class with different long paths.
///
/// If sorted by retaining path this class will be the second from the top.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

// This is the Perfetto data from [samplePerformanceData] as data class objects.

// ignore_for_file: avoid_classes_with_only_static_members

import 'dart:convert';

import 'package:devtools_app/devtools_app.dart';
Expand Down Expand Up @@ -129,7 +127,7 @@ final timelineEventWithShaderJank = testTimelineEvent(
);

/// Data for Frame (id: 2)
abstract class FlutterFrame2 {
extension FlutterFrame2 on Never {
static final frame =
FlutterFrame.fromJson({
'number': 2,
Expand Down Expand Up @@ -364,7 +362,7 @@ abstract class FlutterFrame2 {
}

/// Data for Frame (id: 4)
abstract class FlutterFrame4 {
extension FlutterFrame4 on Never {
static final frame = FlutterFrame.fromJson(_frameJson)
..setEventFlow(uiEvent)
..setEventFlow(rasterEvent);
Expand Down Expand Up @@ -929,7 +927,7 @@ abstract class FlutterFrame4 {
}

/// Data for Frame (id: 6)
abstract class FlutterFrame6 {
extension FlutterFrame6 on Never {
static final frame = FlutterFrame.fromJson(_frameJson)
..setEventFlow(uiEvent)
..setEventFlow(rasterEvent);
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools_shared/lib/src/server/file_system.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'package:path/path.dart' as path;

import 'devtools_store.dart';

// ignore: avoid_classes_with_only_static_members, requires refactor.
class LocalFileSystem {
/// A namespace local file system utlities.
extension LocalFileSystem on Never {
static String _userHomeDir() {
final envKey = Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
return Platform.environment[envKey] ?? '.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _AppSizeHandler {
/// A namespace for app size server request handlers.
extension _AppSizeHandler on Never {
static shelf.Response getBaseAppSizeFile(
ServerApi api,
Map<String, String> queryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _DeeplinkApiHandler {
/// A namespace for deep link server request handlers.
extension _DeeplinkApiHandler on Never {
static Future<shelf.Response> handleAndroidBuildVariants(
ServerApi api,
Map<String, String> queryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _ExtensionsApiHandler {
/// A namespace for DevTools extensions server request handlers.
extension _ExtensionsApiHandler on Never {
static Future<shelf.Response> handleServeAvailableExtensions(
ServerApi api,
Map<String, String> queryParams,
Expand Down
5 changes: 2 additions & 3 deletions packages/devtools_shared/lib/src/server/handlers/_dtd.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _DtdApiHandler {
/// A namespace for Dart Tooling Daemon (DTD) server request handlers.
extension _DtdApiHandler on Never {
static shelf.Response handleGetDtdUri(
ServerApi api,
DtdInfo? dtd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _PreferencesApiHandler {
/// A namespace for preferences server request handlers.
extension _PreferencesApiHandler on Never {
static shelf.Response getPreferenceValue<T>(
ServerApi api,
Map<String, String> queryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _ReleaseNotesHandler {
/// A namespace for release notes server request handlers.
extension _ReleaseNotesHandler on Never {
static shelf.Response getLastReleaseNotesVersion(
ServerApi api,
DevToolsUsage devToolsStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _StorageHandler {
/// A namespace for local storage request handlers.
extension _StorageHandler on Never {
static shelf.Response handleGetStorageValue<T>(
ServerApi api,
DevToolsUsage devToolsStore, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

abstract class _SurveyHandler {
/// A namespace for DevTools survey server request handlers.
extension _SurveyHandler on Never {
static shelf.Response setActiveSurvey(
ServerApi api,
Map<String, String> queryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

// ignore_for_file: avoid_classes_with_only_static_members

part of '../server_api.dart';

/// A namespace for VM service related server request handlers.
@visibleForTesting
abstract class Handler {
extension VmServiceHandler on Never {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically a breaking rename, but this is a visibleForTesting member so no changelog update / version bump required.

/// Stores the calculated package roots for VM service connections that are
/// initiated in [handleNotifyForVmServiceConnection].
///
Expand Down Expand Up @@ -68,7 +67,6 @@ abstract class Handler {
vmServiceUriAsString: vmServiceUriAsString,
vmServiceUri: vmServiceUri,
connected: connected,
api: api,
dtd: dartToolingDaemon,
);
if (detectRootResponse.success) {
Expand Down Expand Up @@ -98,7 +96,6 @@ abstract class Handler {
required String vmServiceUriAsString,
required Uri vmServiceUri,
required bool connected,
required ServerApi api,
required DartToolingDaemon dtd,
}) async {
final Uri rootPackageUri;
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools_shared/lib/src/server/server_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ part 'handlers/_app_size.dart';
part 'handlers/_deeplink.dart';
part 'handlers/_devtools_extensions.dart';
part 'handlers/_dtd.dart';
part 'handlers/_general.dart';
part 'handlers/_vm_service.dart';
part 'handlers/_preferences.dart';
part 'handlers/_release_notes.dart';
part 'handlers/_storage.dart';
Expand Down Expand Up @@ -64,7 +64,7 @@ class ServerApi {
final queryParams = request.requestedUri.queryParameters;
switch (request.url.path) {
case apiNotifyForVmServiceConnection:
return Handler.handleNotifyForVmServiceConnection(
return VmServiceHandler.handleNotifyForVmServiceConnection(
api,
queryParams,
dtd,
Expand Down
Loading
Loading