-
Notifications
You must be signed in to change notification settings - Fork 83
Add Dart Code Metrics #2055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Dart Code Metrics #2055
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
- avoid-unrelated-type-assertions | ||
- avoid-unused-parameters | ||
- binary-expression-operand-order | ||
- double-literal-format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you include all of the lint rules for DCM here with the ones you have not enabled commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added changes for this (and other PR comments) at #2072
@@ -62,7 +62,7 @@ void _registerListeners() { | |||
Future<void> _handleRuntimeMessages( | |||
dynamic jsRequest, | |||
MessageSender sender, | |||
Function sendResponse, | |||
Function _, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure this change is an improvement. consider using an ignore comment instead. DCM should be able to figure out that the arg is needed based on where this is used as a listener.
@@ -29,7 +29,7 @@ final _eventsForAngularDartDevTools = { | |||
|
|||
Future<void> handleMessagesFromAngularDartDevTools( | |||
dynamic jsRequest, | |||
MessageSender sender, | |||
MessageSender _, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider an ignore comment here as well.
@@ -107,7 +107,8 @@ void _forwardMessageToAngularDartDevTools(ExternalExtensionMessage message) { | |||
chrome.runtime.sendMessage( | |||
_angularDartDevToolsId, | |||
message, | |||
/* options */ null, | |||
/* options */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would switch this to a // comment
odd we don't have any lints to warn about /* comments within a method body
@@ -234,9 +234,11 @@ _enableExecutionContextReporting(int tabId) { | |||
if (chromeError != null) { | |||
final errorMessage = _translateChromeError(chromeError.message); | |||
chrome.notifications.create( | |||
/*notificationId*/ null, | |||
/*notificationId*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before. Switch these to // comment
@@ -42,7 +42,7 @@ Future<Tab?> getTab(int tabId) { | |||
return completer.future; | |||
} | |||
|
|||
Future<Tab?> get activeTab async { | |||
Future<Tab?> get activeTab { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i keep finding it interesting how many cases this lint catches.
@@ -619,6 +616,12 @@ class AppInspector implements AppInspectorInterface { | |||
}); | |||
} | |||
|
|||
Iterable<String> _userLibraryUris(Iterable<LibraryRef> libraries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what lint caused this refactor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I think this snuck in when I was trying to address:
metrics:
cyclomatic-complexity: 20
number-of-parameters: 5
maximum-nesting-level: 5
before disabling those checks as a follow-up. Forget to revert the changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Work towards #2053
Applies fixes for rules that are trivial to fix. Rules with non-trivial fixes are commented out, with TODO.