Skip to content

Commit

Permalink
Expand NonBooleanPropertyPrefixedWithIs to support boolean functions …
Browse files Browse the repository at this point in the history
…with parameters
  • Loading branch information
brittany committed Sep 8, 2022
1 parent a30ba17 commit 3117ac8
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -72,7 +72,7 @@ class NonBooleanPropertyPrefixedWithIs(config: Config = Config.empty) : Rule(con

if (!typeName.isNullOrEmpty() &&
isNotBooleanType &&
!type.isBooleanFunctionReference()
!type.isBooleanFunction()
) {
report(
reportCodeSmell(declaration, name, typeName)
Expand Down Expand Up @@ -101,9 +101,9 @@ class NonBooleanPropertyPrefixedWithIs(config: Config = Config.empty) : Rule(con
fqNameOrNull()
?.asString()

private fun KotlinType.isBooleanFunctionReference(): Boolean {
private fun KotlinType.isBooleanFunction(): Boolean {
if (!isFunctionOrKFunctionTypeWithAnySuspendability) return false

return arguments.count() == 1 && arguments[0].type.isBoolean()
return arguments.isNotEmpty() && arguments.last().type.isBoolean()
}
}

0 comments on commit 3117ac8

Please sign in to comment.