Hi everyone, I'm new to writing custom ktlint rules. I have a rule to check if my utility method is used or not. For example:
fun Something.doSomething() {
assertThat(abc).isFalse
}
In my rule I check that if the function is
doSomething()
then allow using
assertThat(abc).isFalse
Every other place I throw an error and ask them to reuse
Something.doSomething()
How do I only skip this function inspection?
I was thinking of using
stopTraversalOfAST()
but this will stop inspection for the whole file.
For example, lets consider a file:
File Abc.kt
function Something.doSomething() {
assertThat(abc).isFalse
}
function Something.doSomethingElse() {
assertThat(abc).isFalse
//some more code
}
Here, I want my rule to complain and throw an error in
doSomethingElse()