-
-
Notifications
You must be signed in to change notification settings - Fork 774
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 ignoreOverridden option for TooManyFunctions rule - #1411 #1488
Add ignoreOverridden option for TooManyFunctions rule - #1411 #1488
Conversation
@@ -117,6 +117,7 @@ complexity: | |||
thresholdInEnums: 11 | |||
ignoreDeprecated: false | |||
ignorePrivate: false | |||
ignoreOverridden: false |
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 think this should be true
by default.
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.
Thanks for the contribution. Please remove this config option and just ignore enums by default. Otherwise, the code looks fine. Thanks for your contribution! :)
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.
@schalkms Did you mean ignore overriden functions by default without additional rule option?
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 also don't understand what @schalkms wrote :)? Active by default is okay for me too ^^
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 am really sorry. I mixed it up with the proposal to ignore enum classes in #1489
Everything is fine.
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.
Well maybe it shouldn't be true by default. Better to be strict by default and relaxed when needed.
It also aligns with the other ignore options.
Codecov Report
@@ Coverage Diff @@
## master #1488 +/- ##
============================================
+ Coverage 74.74% 74.75% +<.01%
- Complexity 1732 1734 +2
============================================
Files 328 328
Lines 5270 5272 +2
Branches 957 958 +1
============================================
+ Hits 3939 3941 +2
Misses 805 805
Partials 526 526
Continue to review full report at Codecov.
|
@@ -124,6 +127,7 @@ class TooManyFunctions(config: Config = Config.empty) : Rule(config) { | |||
private fun isIgnoredFunction(function: KtNamedFunction): Boolean = when { | |||
ignoreDeprecated && function.annotationEntries.any { it.typeReference?.text == DEPRECATED } -> true | |||
ignorePrivate && function.isPrivate() -> true | |||
ignoreOverridden && (function.modifierList?.hasModifier(KtTokens.OVERRIDE_KEYWORD) ?: false) -> true |
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.
Please use function.isOverride()
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.
I did not notice that the project already has an extension function for that.
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.
No problem, thanks for contributing :)!
closes #1411