Created
October 4, 2019 00:58
-
-
Save amadeu01/f59b7c4fd78f430f969b4fe30d731803 to your computer and use it in GitHub Desktop.
Custom no var rule
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
class NoVarRule : Rule("no-var") { | |
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) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment