-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
BooleanPropertyNaming highlight only the name of the variable #5431
BooleanPropertyNaming highlight only the name of the variable #5431
Conversation
...naming/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/naming/BooleanPropertyNamingSpec.kt
Show resolved
Hide resolved
@@ -79,7 +79,7 @@ class BooleanPropertyNaming(config: Config = Config.empty) : Rule(config) { | |||
val description = "Boolean property name should match a $allowedPattern pattern." | |||
return CodeSmell( | |||
issue, | |||
Entity.from(declaration), | |||
Entity.from(declaration.nameIdentifier ?: declaration), |
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.
Could this be statically checked in the new ruleset as a best practice? e.g. if the "thing" passed into Entity.from
has a "name" (e.g. inherits from PsiNameIdentifierOwner
), then report("use '.nameIdentifier' instead")
?
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'm not sure if this could apply to all the cases. But that seems like a doable rule so anyone can implement it and check if my statment is true.
...les-naming/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/BooleanPropertyNaming.kt
Show resolved
Hide resolved
255d6eb
to
e0514d9
Compare
@@ -79,7 +79,7 @@ class BooleanPropertyNaming(config: Config = Config.empty) : Rule(config) { | |||
val description = "Boolean property name should match a $allowedPattern pattern." | |||
return CodeSmell( | |||
issue, | |||
Entity.from(declaration), | |||
Entity.from(declaration.nameIdentifier ?: declaration), |
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'm not sure if this could apply to all the cases. But that seems like a doable rule so anyone can implement it and check if my statment is true.
...les-naming/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/naming/BooleanPropertyNaming.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Brais Gabín <braisgabin@gmail.com>
... the usual, the warning hides too much, but also deeplinking is broken, e.g. clicking on the this code location:
brings me to (before)
(expected)