-
-
Notifications
You must be signed in to change notification settings - Fork 767
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
MemberNameEqualsClassName should ignore overridden property names too #2104
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2104 +/- ##
============================================
+ Coverage 80.48% 80.49% +<.01%
+ Complexity 2018 2013 -5
============================================
Files 336 336
Lines 5802 5799 -3
Branches 1064 1063 -1
============================================
- Hits 4670 4668 -2
Misses 564 564
+ Partials 568 567 -1
Continue to review full report at Codecov.
|
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.
Looks good, just a bit of minor feedback and another pair of eyes to go over it to make sure I didn't miss anything!
...-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/MemberNameEqualsClassName.kt
Outdated
Show resolved
Hide resolved
...-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/MemberNameEqualsClassName.kt
Outdated
Show resolved
Hide resolved
""" | ||
assertThat(MemberNameEqualsClassName().compileAndLint(code)).hasSize(1) | ||
} | ||
|
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.
Looks like this example wasn't migrated from the existing MemberNameEqualsClassNamePositive
file:
class WrongFactoryClass1 {
companion object {
fun wrongFactoryClass1() {} // reports 1 - no return type
}
}
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 thought that both tests was testing exactly the same thing for that reason I removed one. I added it again.
The fail seems flaky |
…#2104) * Split failing tests in MemberNameEqualsClassNameSpec * Add missing test to check ignoreOverriddenFunction in MemberNameEqualsClassName * Don't use List.concat, it doesn't handle the nullables correctly * Use sequence instead of list * Ignore overridden properties too in MemberNameEqualsClassName * Update documentation * Add missing test from commit 30356f9
…detekt#2104) * Split failing tests in MemberNameEqualsClassNameSpec * Add missing test to check ignoreOverriddenFunction in MemberNameEqualsClassName * Don't use List.concat, it doesn't handle the nullables correctly * Use sequence instead of list * Ignore overridden properties too in MemberNameEqualsClassName * Update documentation * Add missing test from commit 30356f9
…detekt#2104) * Split failing tests in MemberNameEqualsClassNameSpec * Add missing test to check ignoreOverriddenFunction in MemberNameEqualsClassName * Don't use List.concat, it doesn't handle the nullables correctly * Use sequence instead of list * Ignore overridden properties too in MemberNameEqualsClassName * Update documentation * Add missing test from commit 30356f9
Right now
MemberNameEqualsClassName
only allows to ignore overridden functions. This PR change that to ignore both: functions and properties.This PR is related with this issue: #2096
In the future we should rename the flag
ignoreOverriddenFunction
toignoreOverridden
. But that's a breaking change. We are talking about that at #2096