Created
December 1, 2019 12:54
-
-
Save olegosipenko/58e9a042685b187f32fb6d6b364a06c5 to your computer and use it in GitHub Desktop.
For blog post about sealed classes, when expressions and custom detekt rule Raw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun visitLambdaExpression(lambdaExpression: KtLambdaExpression) { | |
super.visitLambdaExpression(lambdaExpression) | |
val whenExpressions = lambdaExpression.bodyExpression?.statements | |
?.filterIsInstance<KtWhenExpression>() | |
if (whenExpressions?.isNotEmpty() == true) { | |
report( | |
CodeSmell( | |
issue, Entity.from(lambdaExpression), MESSAGE | |
) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment