diff --git a/src/ameba/ast/visitors/node_visitor.cr b/src/ameba/ast/visitors/node_visitor.cr index 4e6e3618..c537b86c 100644 --- a/src/ameba/ast/visitors/node_visitor.cr +++ b/src/ameba/ast/visitors/node_visitor.cr @@ -1,34 +1,6 @@ require "./base_visitor" module Ameba::AST - # List of nodes to be visited by Ameba's rules. - NODES = { - Alias, - IsA, - Assign, - Call, - Block, - Case, - ClassDef, - ClassVar, - Def, - EnumDef, - ExceptionHandler, - Expressions, - HashLiteral, - If, - InstanceVar, - LibDef, - ModuleDef, - NilLiteral, - StringInterpolation, - Unless, - Var, - When, - While, - Until, - } - # An AST Visitor that traverses the source and allows all nodes # to be inspected by rules. # @@ -36,6 +8,34 @@ module Ameba::AST # visitor = Ameba::AST::NodeVisitor.new(rule, source) # ``` class NodeVisitor < BaseVisitor + # List of nodes to be visited by Ameba's rules. + NODES = { + Alias, + IsA, + Assign, + Call, + Block, + Case, + ClassDef, + ClassVar, + Def, + EnumDef, + ExceptionHandler, + Expressions, + HashLiteral, + If, + InstanceVar, + LibDef, + ModuleDef, + NilLiteral, + StringInterpolation, + Unless, + Var, + When, + While, + Until, + } + @skip : Array(Crystal::ASTNode.class)? def initialize(@rule, @source, skip = nil)