Skip to content
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

- Added excludeNames param for function_lines_of_code lint #141

Merged

Conversation

DerhachevAndrii
Copy link
Contributor

  • Added excludeNames param for function_lines_of_code lint

Copy link
Collaborator

@solid-vovabeloded solid-vovabeloded left a comment

Choose a reason for hiding this comment

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

Added a few suggestions here, but looks good overall.

Comment on lines 63 to 73
final name = () {
if (node is FunctionDeclaration) {
return node.name.lexeme;
} else if (node is MethodDeclaration) {
return node.name.lexeme;
} else if (node is FunctionExpression) {
return node.declaredElement?.name;
} else {
return null;
}
}();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, extract this into a separate private method or just inline it into current method. Do not use inline function declaration since it hurts readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -5,16 +5,22 @@ class FunctionLinesOfCodeParameters {
/// exceeding this limit triggers a warning.
final int maxLines;

/// Method names to be excluded from the rule check
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// Method names to be excluded from the rule check
/// Function names to be excluded from the rule check

Does it make sense to be consistent with all the rest documentation/naming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines +19 to +21
return i;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be great to also test that it does not report false positives for both - methods and functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for changing the file name to a proper one!

@DerhachevAndrii DerhachevAndrii linked an issue Mar 15, 2024 that may be closed by this pull request
@DerhachevAndrii DerhachevAndrii merged commit 9adae1f into master Mar 15, 2024
2 checks passed
@DerhachevAndrii DerhachevAndrii deleted the Andrii-Derhachev-function_lines_of_code_improvement branch March 15, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add exception list to function_lines_of_code (build method)
2 participants