Skip to content

Commit

Permalink
Upgrade dcm version and analyze all packages (#8311)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll committed Sep 11, 2024
1 parent 7efeecf commit 2b3bed9
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ jobs:
wget -qO- https://dcm.dev/pgp-key.public | sudo gpg --dearmor -o /usr/share/keyrings/dcm.gpg
echo 'deb [signed-by=/usr/share/keyrings/dcm.gpg arch=amd64] https://dcm.dev/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt-get update
sudo apt-get install dcm=1.18.1-1 # To avoid errors add `-1` (build number) to the version
sudo apt-get install dcm=1.22.0-1 # To avoid errors add `-1` (build number) to the version
sudo chmod +x /usr/bin/dcm
echo "$(dcm --version)"
- name: Setup Dart SDK
uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
- name: Run DCM on root
run: |
dcm analyze packages/devtools_app packages/devtools_shared packages/devtools_test
dcm analyze packages/devtools_app packages/devtools_app_shared packages/devtools_extensions packages/devtools_shared packages/devtools_test
test-packages:
name: ${{ matrix.package }} test
Expand Down
2 changes: 1 addition & 1 deletion flutter-candidate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aea84342eb861832bbf8578de432c4da5a074136
9108b6d0cff1eb95377153559c01d48f725760ba
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class ProgramExplorerController extends DisposableController
Iterable<FuncRef> funcs,
Iterable<FieldRef>? fields,
) async {
final res = await Future.wait<Func>(
return await Future.wait<Func>(
funcs
.where((f) => !_isSyntheticAccessor(f, fields as List<FieldRef>))
.map<Future<Func>>(
Expand Down Expand Up @@ -296,7 +296,6 @@ class ProgramExplorerController extends DisposableController
}),
),
);
return res.cast<Func>();
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ class _MultilineMatcher extends GrammarMatcher {
patterns = (json['patterns'] as List<Object?>?)
?.cast<Map<String, Object?>>()
.map((e) => GrammarMatcher.fromJson(e))
.toList()
.cast<GrammarMatcher>(),
.toList(),
super._();

static bool isType(Map<String, Object?> json) {
Expand Down Expand Up @@ -521,8 +520,7 @@ class _PatternMatcher extends GrammarMatcher {
: patterns = (json['patterns'] as List<Object?>?)
?.cast<Map<String, Object?>>()
.map((e) => GrammarMatcher.fromJson(e))
.toList()
.cast<GrammarMatcher>(),
.toList(),
super._();

static bool isType(Map<String, Object?> json) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,16 @@ class AnimatedLayoutProperties<T extends LayoutProperties>
List<double> childrenDimensions(Axis axis) {
final beginDimensions = begin.childrenDimensions(axis);
final endDimensions = end.childrenDimensions(axis);
return _lerpList(beginDimensions, endDimensions).cast<double>();
return _lerpList(beginDimensions, endDimensions);
}

@override
List<double> get childrenHeights =>
_lerpList(begin.childrenHeights, end.childrenHeights).cast<double>();
_lerpList(begin.childrenHeights, end.childrenHeights);

@override
List<double> get childrenWidths =>
_lerpList(begin.childrenWidths, end.childrenWidths).cast<double>();
_lerpList(begin.childrenWidths, end.childrenWidths);

@override
BoxConstraints? get constraints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class VisualizeWidthAndHeightWithConstraints extends StatelessWidget {
if (showOverflowHeight)
TextSpan(
text: '\nchildren take: '
'${toStringAsFixed(sum(propertiesLocal.childrenHeights.cast<double>()))}',
'${toStringAsFixed(sum(propertiesLocal.childrenHeights))}',
),
],
),
Expand Down Expand Up @@ -122,7 +122,7 @@ class VisualizeWidthAndHeightWithConstraints extends StatelessWidget {
if (showChildrenWidthsSum)
TextSpan(
text: '\nchildren take '
'${toStringAsFixed(sum(propertiesLocal.childrenWidths.cast<double>()))}',
'${toStringAsFixed(sum(propertiesLocal.childrenWidths))}',
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,16 @@ class AnimatedLayoutProperties<T extends LayoutProperties>
List<double> childrenDimensions(Axis axis) {
final beginDimensions = begin.childrenDimensions(axis);
final endDimensions = end.childrenDimensions(axis);
return _lerpList(beginDimensions, endDimensions).cast<double>();
return _lerpList(beginDimensions, endDimensions);
}

@override
List<double> get childrenHeights =>
_lerpList(begin.childrenHeights, end.childrenHeights).cast<double>();
_lerpList(begin.childrenHeights, end.childrenHeights);

@override
List<double> get childrenWidths =>
_lerpList(begin.childrenWidths, end.childrenWidths).cast<double>();
_lerpList(begin.childrenWidths, end.childrenWidths);

@override
BoxConstraints? get constraints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class VisualizeWidthAndHeightWithConstraints extends StatelessWidget {
if (showOverflowHeight)
TextSpan(
text: '\nchildren take: '
'${toStringAsFixed(sum(propertiesLocal.childrenHeights.cast<double>()))}',
'${toStringAsFixed(sum(propertiesLocal.childrenHeights))}',
),
],
),
Expand Down Expand Up @@ -122,7 +122,7 @@ class VisualizeWidthAndHeightWithConstraints extends StatelessWidget {
if (showChildrenWidthsSum)
TextSpan(
text: '\nchildren take '
'${toStringAsFixed(sum(propertiesLocal.childrenWidths.cast<double>()))}',
'${toStringAsFixed(sum(propertiesLocal.childrenWidths))}',
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ class FrameAnalysis {
if (uiEvent == null) {
return FramePhase.build(events: <FlutterTimelineEvent>[]);
}
final buildEvents = uiEvent
.nodesWithCondition(
(event) => FramePhaseType.build.isMatchForEventName(event.name),
)
.cast<FlutterTimelineEvent>();
final buildEvents = uiEvent.nodesWithCondition(
(event) => FramePhaseType.build.isMatchForEventName(event.name),
);
return FramePhase.build(events: buildEvents);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,7 @@ extension type _CpuProfileDataJson(Map<String, Object?> json) {
?.cast<Map>()
.map((trace) => trace.cast<String, Object?>())
.map((trace) => CpuSampleEvent.fromJson(trace))
.toList()
.cast<CpuSampleEvent>();
.toList();
}

class CpuProfileMetaData extends ProfileMetaData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ class _InstanceViewerState extends ConsumerState<InstanceViewer> {
ref,
path: widget.rootPath,
disableExpand: true,
// ignore: avoid-unnecessary-type-casts, this code will be removed soon.
).cast<Widget?>(), // This cast is necessary to avoid Null type errors
estimatedChildCount:
ref.watch(estimatedChildCountProvider(widget.rootPath)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ class ClassHierarchyExplorerController {
final isolateId = isolate.id!;
final classList = await service.getClassList(isolateId);
// TODO(bkonyi): we should cache the class list like we do the script list
final classes = (await Future.wait([
final classes = await Future.wait([
for (final cls in classList.classes!)
service.getObject(isolateId, cls.id!).then((e) => e as Class),
]))
.cast<Class>();
]);

buildHierarchy(classes);
}
Expand Down
1 change: 0 additions & 1 deletion packages/devtools_app/lib/src/shared/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import 'package:vm_service/vm_service.dart';

// ignore: avoid-importing-entrypoint-exports, special case for getting version.
import '../../devtools.dart' as devtools;

import 'common_widgets.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ void main() {
await controller.networkService.refreshNetworkData();
requests = requestsNotifier.value;
expect(requests.length, numRequests);
final httpRequests = requests
.whereType<DartIOHttpRequestData>()
.cast<DartIOHttpRequestData>()
.toList();
final httpRequests = requests.whereType<DartIOHttpRequestData>().toList();
for (final request in httpRequests) {
expect(request.duration, request.inProgress ? isNull : isNotNull);
expect(request.general.length, greaterThan(0));
Expand Down
1 change: 0 additions & 1 deletion packages/devtools_app/test/network/network_table_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ void main() {
DartIOHttpRequestData findRequestById(String id) {
return requests
.whereType<DartIOHttpRequestData>()
.cast<DartIOHttpRequestData>()
.firstWhere((request) => request.id == id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ class ServiceManager<T extends VmService> {
String name, {
String? isolateId,
Map<String, dynamic>? args,
// ignore: avoid-redundant-async, for some reasons tests fail without `async
}) async {
final registeredMethod = _registeredMethodsForService[name];
if (registeredMethod == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.

// ignore_for_file: avoid-unused-parameters, intentional empty methods for stub file.

Map<String, String> loadQueryParams() => {};

/// Gets the URL from the browser.
Expand All @@ -13,7 +15,6 @@ String? getWebUrl() => null;
///
/// No-op for non-web platforms.
// Unused parameter lint doesn't make sense for stub files.
// ignore: avoid-unused-parameters
void webRedirect(String url) {}

/// Updates the query parameter with [key] to the new [value], and optionally
Expand Down

0 comments on commit 2b3bed9

Please sign in to comment.