Hello Friends, I am working with Ktlint custom rul...
# android
m
Hello Friends, I am working with Ktlint custom ruleset . I have written one custom rule. When i try to execute that rule then it will execute successfully without any error, but it should show error. Here is my CustomRule class
Copy code
class CustomRule : Rule("FunctionNamingConvention") {
    override fun visit(
        node: ASTNode,
        autoCorrect: Boolean,
        emit: (offset: Int, errorMessage: String, canBeAutoCorrected: Boolean) -> Unit
    ) {
     
        if (node.elementType == VAR_KEYWORD) {
            emit(node.startOffset, "Unexpected var, use val instead", false)
        }
    }
}
Here is i have register that class.
Copy code
class CustomRuleSetProvider : RuleSetProvider {
    override fun get(): RuleSet {
        return RuleSet("FunctionNamingConvention", CustomRule())
    }
}
Any one have idea about this?
a
#ktlint may be a better place for this question
s
Did you get your issue resolved?
m
@sorianog No