Skip to content

Commit d6b3e9c

Browse files
authored
Dart Code Metrics follow-up (#2072)
1 parent 48e3211 commit d6b3e9c

8 files changed

+54
-28
lines changed

Diff for: dwds/analysis_options.yaml

+37-15
Original file line numberDiff line numberDiff line change
@@ -26,41 +26,63 @@ linter:
2626
# TODO(https://github.com/dart-lang/webdev/issues/2053): Enable commented-out rules with fixes.
2727
dart_code_metrics:
2828
metrics:
29-
# cyclomatic-complexity: 20
30-
# number-of-parameters: 5
31-
# maximum-nesting-level: 5
29+
# cyclomatic-complexity: 20 # Enable.
30+
# number-of-parameters: 5 # Enable.
31+
# maximum-nesting-level: 5 # Enable.
3232
metrics-exclude:
3333
- test/**
3434
rules:
35+
# - arguments-ordering
36+
# - avoid-banned-imports
3537
- avoid-cascade-after-if-null
3638
- avoid-collection-methods-with-unrelated-types
39+
# - avoid-double-slash-imports
3740
- avoid-duplicate-exports
38-
# - avoid-global-state
41+
# - avoid-dynamic
42+
# - avoid-global-state # Enable.
43+
# - avoid-ignoring-return-values
44+
# - avoid-late-keyword
3945
- avoid-missing-enum-constant-in-map
4046
- avoid-nested-conditional-expressions
4147
- avoid-non-ascii-symbols
42-
# - avoid-non-null-assertion
43-
# - avoid-passing-async-when-sync-expected
48+
# - avoid-non-null-assertion # Enable.
49+
# - avoid-passing-async-when-sync-expected # Enable.
4450
- avoid-redundant-async
45-
# - avoid-throw-in-catch-block
51+
# - avoid-throw-in-catch-block # Enable.
52+
# - avoid-top-level-members-in-tests
53+
# - avoid-unnecessary-conditionals
4654
- avoid-unnecessary-type-assertions
4755
- avoid-unnecessary-type-casts
4856
- avoid-unrelated-type-assertions
4957
- avoid-unused-parameters
58+
# - ban-name
5059
- binary-expression-operand-order
5160
- double-literal-format
52-
# - format-comment
53-
# - member-ordering
61+
# - format-comment # Enable.
62+
# - list-all-equatable-fields
63+
# - member-ordering # Enable.
64+
# - missing-test-assertion
65+
# - new-line-before-return
5466
- no-boolean-literal-compare
55-
# - no-empty-block
67+
# - no-empty-block # Enable.
68+
# - no-equal-arguments
5669
- no-equal-then-else
57-
# - prefer-async-await
58-
# - prefer-commenting-analyzer-ignores
59-
# - prefer-correct-test-file-name
70+
# - no-magic-number
71+
# - no-object-declaration
72+
# - prefer-async-await # Enable.
73+
# - prefer-commenting-analyzer-ignores # Enable.
74+
# - prefer-conditional-expressions
75+
# - prefer-correct-identifier-length
76+
# - prefer-correct-test-file-name # Enable.
6077
- prefer-correct-type-name
6178
- prefer-enums-by-name
62-
# - prefer-immediate-return
79+
# - prefer-first
80+
# - prefer-immediate-return # Enable.
6381
- prefer-iterable-of
6482
- prefer-last
65-
# - prefer-moving-to-variable:
83+
# - prefer-match-file-name
84+
# - prefer-moving-to-variable: # Enable.
6685
# allow-duplicated-chains: 2
86+
# - prefer-static-class
87+
# - prefer-trailing-comma
88+
# - tag-name

Diff for: dwds/debug_extension_mv3/web/background.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ void _registerListeners() {
6262
Future<void> _handleRuntimeMessages(
6363
dynamic jsRequest,
6464
MessageSender sender,
65-
Function _,
65+
// ignore: avoid-unused-parameters
66+
Function sendResponse,
6667
) async {
6768
if (jsRequest is! String) return;
6869

Diff for: dwds/debug_extension_mv3/web/cross_extension_communication.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ final _eventsForAngularDartDevTools = {
2929

3030
Future<void> handleMessagesFromAngularDartDevTools(
3131
dynamic jsRequest,
32-
MessageSender _,
32+
// ignore: avoid-unused-parameters
33+
MessageSender sender,
3334
Function sendResponse,
3435
) async {
3536
if (jsRequest == null) return;
@@ -107,7 +108,7 @@ void _forwardMessageToAngularDartDevTools(ExternalExtensionMessage message) {
107108
chrome.runtime.sendMessage(
108109
_angularDartDevToolsId,
109110
message,
110-
/* options */
111+
// options
111112
null,
112113
allowInterop(([result]) => _checkForErrors(result, message.name)),
113114
);

Diff for: dwds/debug_extension_mv3/web/debug_session.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ _enableExecutionContextReporting(int tabId) {
234234
if (chromeError != null) {
235235
final errorMessage = _translateChromeError(chromeError.message);
236236
chrome.notifications.create(
237-
/*notificationId*/
237+
// notificationId
238238
null,
239239
NotificationOptions(message: errorMessage),
240-
/*callback*/
240+
// callback
241241
null,
242242
);
243243
return;
@@ -684,7 +684,7 @@ Future<bool> _sendAuthRequest(String authUrl) async {
684684
Future<bool> _showWarningNotification(String message) {
685685
final completer = Completer<bool>();
686686
chrome.notifications.create(
687-
/*notificationId*/
687+
// notificationId
688688
null,
689689
NotificationOptions(
690690
title: '[Error] Dart Debug Extension',

Diff for: dwds/debug_extension_mv3/web/lifeline_connection.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void _connectToLifelinePort() {
1515
prefix: 'Dart Debug Extension',
1616
);
1717
chrome.runtime.connect(
18-
/*extensionId=*/
18+
// extensionId
1919
null,
2020
ConnectInfo(name: 'keepAlive'),
2121
);

Diff for: dwds/debug_extension_mv3/web/messaging.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ Future<bool> sendRuntimeMessage({
118118
);
119119
final completer = Completer<bool>();
120120
chrome.runtime.sendMessage(
121-
/*id*/
121+
// id
122122
null,
123123
message.toJSON(),
124-
/*options*/
124+
// options
125125
null,
126126
allowInterop(() {
127127
final error = chrome.runtime.lastError;

Diff for: dwds/debug_extension_mv3/web/panel.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ Future<void> _registerListeners() async {
7777

7878
void _handleRuntimeMessages(
7979
dynamic jsRequest,
80-
MessageSender _,
81-
Function __,
80+
// ignore: avoid-unused-parameters
81+
MessageSender sender,
82+
// ignore: avoid-unused-parameters
83+
Function sendResponse,
8284
) {
8385
if (jsRequest is! String) return;
8486

Diff for: dwds/debug_extension_mv3/web/utils.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ void setExtensionIcon(IconInfo info) {
9898
if (isMV3) {
9999
_setExtensionIconMV3(
100100
info,
101-
/*callback*/
101+
// callback
102102
null,
103103
);
104104
} else {
105105
_setExtensionIconMV2(
106106
info,
107-
/*callback*/
107+
// callback
108108
null,
109109
);
110110
}

0 commit comments

Comments
 (0)