Hello, I'm trying to write custom detekt rule and ...
# detekt
k
Hello, I'm trying to write custom detekt rule and I need a little help. I want to visit parameter and get name and class.name of parameter. I cannot find a way to extract class name. The only naive way which I found is to extract it from
parameter.text
. Can someone help me do it in proper way?
Copy code
override fun visitParameter(parameter: KtParameter) {
    super.visitParameter(parameter)
    val name = parameter.name
    val className = TODO()
}
a
not exactly correct syntax
Copy code
val className = paramete.getParentOfType<KtClass>()
also is there any function that returns
getDeclartingClass
?
k
Copy code
package com.example

import FetchUseCase

class ViewModel(
   val fetchUseCase: FetchUseCase
)
in this example
className
will be
ViewModel
, but I was expecting
FetchUseCase