Skip to content

Added kotlin duplication checks #320

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

Merged
merged 6 commits into from
Jun 12, 2018
Merged

Conversation

hershamin
Copy link
Contributor

No description provided.

@hershamin hershamin changed the title Added kotlin duplication checks [WIP] Added kotlin duplication checks Jun 5, 2018
@hershamin hershamin changed the title [WIP] Added kotlin duplication checks Added kotlin duplication checks Jun 5, 2018
@larkinscott larkinscott self-requested a review June 6, 2018 16:11
@larkinscott
Copy link
Contributor

Tested this against 30 Kotlin OSS repos. One thing I noticed is that we probably want to exclude the copyright/comments section from duplication analysis. You'll see below that it's being flagged on almost every file:

--- :git: pulling shadowsocks/shadowsocks-android
+++ :codeclimate: :sleuth_or_spy: analyzing shadowsocks/shadowsocks-android
Starting analysis

== mobile/src/androidTest/java/com/github/shadowsocks/acl/AclTest.kt (1 issue) ==
1-19: Similar blocks of code found in 71 locations. Consider refactoring. [duplication]

== mobile/src/androidTest/java/com/github/shadowsocks/database/ProfileTest.kt (1 issue) ==
1-19: Similar blocks of code found in 71 locations. Consider refactoring. [duplication]

== mobile/src/androidTest/java/com/github/shadowsocks/utils/SubnetTest.kt (4 issues) ==
10: Similar blocks of code found in 4 locations. Consider refactoring. [duplication]
11: Similar blocks of code found in 4 locations. Consider refactoring. [duplication]
12-13: Similar blocks of code found in 4 locations. Consider refactoring. [duplication]
14-15: Similar blocks of code found in 4 locations. Consider refactoring. [duplication]

== mobile/src/main/java/com/evernote/android/job/JobConstants.kt (1 issue) ==
1-19: Similar blocks of code found in 71 locations. Consider refactoring. [duplication]

== mobile/src/main/java/com/github/shadowsocks/AboutFragment.kt (2 issues) ==
1-19: Similar blocks of code found in 71 locations. Consider refactoring. [duplication]
44: Similar blocks of code found in 3 locations. Consider refactoring. [duplication]

== mobile/src/main/java/com/github/shadowsocks/App.kt (6 issues) ==
1-19: Similar blocks of code found in 71 locations. Consider refactoring. [duplication]
73: Similar blocks of code found in 3 locations. Consider refactoring. [duplication]
142: Similar blocks of code found in 2 locations. Consider refactoring. [duplication]
176-177: Similar blocks of code found in 3 locations. Consider refactoring. [duplication]
178-179: Similar blocks of code found in 3 locations. Consider refactoring. [duplication]
180-181: Similar blocks of code found in 3 locations. Consider refactoring. [duplication]

We should be able to do this from the DEFAULT_FILTERS constant.

@hershamin
Copy link
Contributor Author

@larkinscott With the latest commit, the issue of comparing comment docs is fixed.

@larkinscott
Copy link
Contributor

Thanks for pointing that out @zenspider! I trimmed the comment sections in the specs a bit.

Copy link
Contributor

@larkinscott larkinscott left a comment

Choose a reason for hiding this comment

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

Trimmed some comments in the specs. Overall, ran it against a large set of OSS projects and the results look good!

@larkinscott larkinscott merged commit 152d119 into master Jun 12, 2018
@larkinscott larkinscott deleted the hershamin/kotlin-duplication branch June 12, 2018 21:03
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.

4 participants