Hi all! We have been using Konsist and the team lo...
# konsist
m
Hi all! We have been using Konsist and the team loves it, but we are now having trouble understanding if the following is possible: Given I have the following classes:
Copy code
open class Event(val properties: Map<String, Any>)
class SomeEvent(paramOne: String, paramTwo: SomeEnum) : Event(
  properties = mapOf("keyOne" to paramOne, "keyTwo" to paramTwo)
)
Is it possible at all to check if one of the params passed to the properties map is of Enum type?
k
imho that does not look like a job for konsist
👍 1
m
Right, so something like this is suppported by detekt for example, but this is not something konsist can (will be able to?) do?
Copy code
expression.valueArguments.forEach { arg ->
            val map = arg.getArgumentExpression() as? KtMap
            map?.entries?.forEach { entry ->
                val valueType = entry.value.getKotlinType()
                if (valueType.isEnum()) {
                    report(
                        CodeSmell()
                    )
                }
            }
        }
@igor.wojda is this kind of functionality planned for the future?
p
I'm also not sure if this is a task I would use Konsist for
i
happy your team likes Konsist. This is an interesting case. ATM this is not possible and I doubt we will do it in the future as this requires type resolution.
m
Ok, thanks a lot for the response! 🙏