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

MemberNameEqualsClassName should ignore overridden property names too #2104

Merged
merged 8 commits into from
Nov 27, 2019
Merged

MemberNameEqualsClassName should ignore overridden property names too #2104

merged 8 commits into from
Nov 27, 2019

Conversation

BraisGabin
Copy link
Member

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 to ignoreOverridden. But that's a breaking change. We are talking about that at #2096

@codecov-io
Copy link

codecov-io commented Nov 19, 2019

Codecov Report

Merging #2104 into master will increase coverage by <.01%.
The diff coverage is 85.71%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...h/detekt/rules/naming/MemberNameEqualsClassName.kt 88.46% <85.71%> (+2.25%) 14 <2> (-5) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3b1de2...98e0aec. Read the comment docs.

@schalkms schalkms added this to the 1.3.0 milestone Nov 19, 2019
Copy link
Member

@3flex 3flex left a 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!

"""
assertThat(MemberNameEqualsClassName().compileAndLint(code)).hasSize(1)
}

Copy link
Member

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
    }
}

Copy link
Member Author

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.

@BraisGabin
Copy link
Member Author

The fail seems flaky

@3flex 3flex merged commit b588cd7 into detekt:master Nov 27, 2019
@arturbosch arturbosch modified the milestones: 1.3.0, 1.2.1 Nov 27, 2019
arturbosch pushed a commit that referenced this pull request Dec 5, 2019
…#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
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
…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
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
…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
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.

5 participants