-
Notifications
You must be signed in to change notification settings - Fork 39
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
Rule 6.4.1: Avoid using utility classes/objects #508
Conversation
### What's done: Made a rule
Codecov Report
@@ Coverage Diff @@
## master #508 +/- ##
============================================
- Coverage 81.25% 81.21% -0.04%
- Complexity 1723 1738 +15
============================================
Files 87 88 +1
Lines 4551 4574 +23
Branches 1361 1371 +10
============================================
+ Hits 3698 3715 +17
Misses 308 308
- Partials 545 551 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/AvoidUtilityClass.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/AvoidUtilityClass.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/AvoidUtilityClass.kt
Outdated
Show resolved
Hide resolved
### What's done: Fixed after review
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/AvoidUtilityClass.kt
Outdated
Show resolved
Hide resolved
### What's done: Fixed after review
# Conflicts: # diktat-analysis.yml # diktat-rules/src/main/kotlin/generated/WarningNames.kt # diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt # diktat-rules/src/main/resources/diktat-analysis-huawei.yml # diktat-rules/src/main/resources/diktat-analysis.yml # info/available-rules.md
### What's done: added suppress
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.
https://github.com/cqfn/diKTat/pull/508/checks?check_run_id=1395759188
Caused by: kotlin.KotlinNullPointerException
at org.cqfn.diktat.ruleset.rules.AvoidUtilityClass.checkClass (AvoidUtilityClass.kt:58)
at org.cqfn.diktat.ruleset.rules.AvoidUtilityClass.visit (AvoidUtilityClass.kt:40)
### What's done: Fixed bug
# Conflicts: # diktat-analysis.yml # diktat-rules/src/main/kotlin/generated/WarningNames.kt # diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt # diktat-rules/src/main/resources/diktat-analysis-huawei.yml # diktat-rules/src/main/resources/diktat-analysis.yml # info/available-rules.md
diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AvoidUtilityClassWarnTest.kt
Outdated
Show resolved
Hide resolved
### What's done: Fixed bug after review
# Conflicts: # diktat-analysis.yml # diktat-rules/src/main/kotlin/generated/WarningNames.kt # diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt # diktat-rules/src/main/resources/diktat-analysis-huawei.yml # diktat-rules/src/main/resources/diktat-analysis.yml
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've just realized that we should take into account tests: in tests there are usually classes with only methods, but they can't be converted. So, you should also check if none of the functions are from tests (we have some sort of method for this, checking file path and annotations).
### What's done: Added handle for tests dirs
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/AvoidUtilityClass.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/AvoidUtilityClass.kt
Show resolved
Hide resolved
### What's done: Added more tests
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.
LGTM, but let's merge it after #556
# Conflicts: # diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt # diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt
### What's done: Fixed according to out code-style
### What's done: Fixed according to out code-style
### What's done: Fixed according to out code-style
### What's done: Fixed according to out code-style
### What's done: Fixed according to out code-style
### What's done: Fixed according to out code-style
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.
LGTM
Actions checklist