Skip to content

Commit

Permalink
Adapt WHEN_WITHOUT_ELSE according to new features of Kotlin 1.6
Browse files Browse the repository at this point in the history
### What's done:
 * changed behavior with expressions that look like enum entries of when: now if all the entries look like enum entries, WHEN_WITHOUT_ELSE rule is ignored
 * added tests

(#1149)
  • Loading branch information
sanyavertolet committed Feb 3, 2022
1 parent 1c02e46 commit 61db505
Showing 1 changed file with 0 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class WhenMustHaveElseRule(configRules: List<RulesConfig>) : DiktatRule(

private fun isOnlyEnumEntries(node: ASTNode): Boolean {
val whenEntries = node.getAllChildrenWithType(WHEN_ENTRY)
println(node.prettyPrint())
val hasConditionsIsPattern = whenEntries.any { it.hasChildOfType(WHEN_CONDITION_IS_PATTERN) }
if (hasConditionsIsPattern) {
return false
Expand Down

0 comments on commit 61db505

Please sign in to comment.