Skip to content

Instantly share code, notes, and snippets.

@amadeu01
Created October 4, 2019 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amadeu01/f59b7c4fd78f430f969b4fe30d731803 to your computer and use it in GitHub Desktop.
Save amadeu01/f59b7c4fd78f430f969b4fe30d731803 to your computer and use it in GitHub Desktop.
Custom no var rule
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