-
-
Notifications
You must be signed in to change notification settings - Fork 760
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
Feature/restrict is properties #2779
Feature/restrict is properties #2779
Conversation
e7497ca
to
dea4f4e
Compare
Codecov Report
@@ Coverage Diff @@
## master #2779 +/- ##
============================================
+ Coverage 80.52% 80.54% +0.02%
- Complexity 2323 2335 +12
============================================
Files 386 387 +1
Lines 6957 6987 +30
Branches 1262 1265 +3
============================================
+ Hits 5602 5628 +26
Misses 726 726
- Partials 629 633 +4
Continue to review full report at Codecov.
|
Thanks for your contribution @imanushin 🎉 The CI is red because there are a couple of detekt failures on your code ( If you run |
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Show resolved
Hide resolved
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Outdated
Show resolved
Hide resolved
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Show resolved
Hide resolved
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Outdated
Show resolved
Hide resolved
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Show resolved
Hide resolved
detekt-rules/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNamingSpec.kt
Show resolved
Hide resolved
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Outdated
Show resolved
Hide resolved
Usually we don't activate a new rule by default. It's safer to have it disable by default and get feedback from the users that enabled it. If there are not issues we can activate it later. |
Please make sure to rebase on top of #2782 when the PR is merged 💪 |
505f50d
to
9e9127e
Compare
f3a84ac
to
cff284f
Compare
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Outdated
Show resolved
Hide resolved
6d77faf
to
8123c7c
Compare
Finally I got green build, however the following test was removed. Could you please help, do you know why it isn't work on ubuntu linux (it perfectly works at my Windows 10 computer)? Removed test: it("should not detect Java Boolean") {
val code = """
class O {
var isDefault: java.lang.Boolean = java.lang.Boolean.FALSE // replacing to "false" doesn't work too
}
"""
val findings = subject.compileAndLintWithContext(env, code)
assertThat(findings).isEmpty()
} |
I guess the failure was due to the fact that on the build instance Given that you rebased on top of master, now you see that there is a job called To test the same scenario on your machine you can invoke:
That will compile the snippets and tell you what's wrong with your code. As an alternative, you can use play.kotlinlang.org: https://pl.kotl.in/W9SFqrlPJ class O {
var isDefault: java.lang.Boolean = java.lang.Boolean(false)
} EDIT: Typos |
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.
A couple of minor typos and we're good to go 👍
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Outdated
Show resolved
Hide resolved
detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/IsPropertyNaming.kt
Outdated
Show resolved
Hide resolved
@arturbosch , much appreciated the text fix. I'll return tests today evening (I couldn't push from working computer, sorry). And I'm ok with merging now, I can add the tests in the separate PR. |
…/naming/IsPropertyNaming.kt Co-authored-by: Nicola Corti <corti.nico@gmail.com>
…/naming/IsPropertyNaming.kt Co-authored-by: Nicola Corti <corti.nico@gmail.com>
b352c6f
to
9b9bcca
Compare
Documentation was regenerated, tests were reverted. |
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.
Awesome 👍
Fix for #2701
What I covered:
isengard
property name is allowed for any type,isDefault
is disallowedThis rule is enabled by default in the naming ruleset, it doesn't have any parameters.