flutter / flutter/devtools

`dcm check-unused-code` false positives

Đang mở
#9,907 6 bình luận 1 reaction 0 người được giao Xem trên GitHub
a: quality cost: low P2
Ngôn ngữ chính
Dart
Star
1.7k
Fork
404
Merge trung bình
6 ngày 17 giờ
Pull request đã merge (30 ngày)
18

Mô tả

Command: `dcm check-unused-code packages/devtools_app/ --exclude-public-api`

False positives (one common theme I see here is that anything used in `assert` statements is falsely determined "unused"):
```
packages/devtools_app/test/test_infra/utils/extent_delegate_utils.dart (1 issue):
✖ unused field _renderObjectInitialized
at packages/devtools_app/test/test_infra/utils/extent_delegate_utils.dart:19:3

packages/devtools_app/lib/src/extensions/embedded/_controller_web.dart (1 issue):
✖ unused field _initialized
at packages/devtools_app/lib/src/extensions/embedded/_controller_web.dart:81:3

packages/devtools_app/lib/src/framework/home_screen.dart (2 issues):
✖ unused method _debugInitVmServiceCache
at packages/devtools_app/lib/src/framework/home_screen.dart:174:3

packages/devtools_app/lib/src/app.dart (2 issues):
✖ unused class _AlternateCheckedModeBanner
at packages/devtools_app/lib/src/app.dart:616:1
✖ unused constructor _AlternateCheckedModeBanner
at packages/devtools_app/lib/src/app.dart:622:3

packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart (1 issue):
✖ unused field _initialized
at packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart:162:3
```

I will add more false positives to this list as I find them (working through different directories https://github.com/flutter/devtools/issues/9906).

@incendial

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by running `dcm check-unused-code packages/devtools_app/ --exclude-public-api` and inspect the reported Dart files, including `extent_delegate_utils.dart`, `_controller_web.dart`, `home_screen.dart`, `app.dart`, and `_perfetto_controller_web.dart`. Trace the listed fields, methods, and classes through their assert usages, then verify that genuine uses are no longer reported while actual unused code still is.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
dart
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.