elvis_code (elvis_core v2.0.0)
Link to this section Summary
Functions
Takes the root node of a parse_tree and returns name and arity of each exported function.
Same as calling find/3 with
#{mode => node, traverse => content}
as the options map.Find all nodes in the tree for which the predicate function returns
true
. The options map has two keys:- -
mode
: when the valuenode
is specified the predicate function receives a tree_node() as its argument. Whenzipper
is specified the argument is the zipper location for the current node. - -
traverse
: the valuecontent
indicates to only take into account nodes in the parent-child hierarchy. Whenall
is provided the nodes held in thenode_attrs
map are also taken into account in the search.
Takes the root node of a parse_tree and returns the name of each function, whether exported or not.
Takes the root node and returns the module's name.
Takes a node and returns all nodes where the nesting limit is exceeded.
Debugging utility function.
Link to this section Types
Link to this type
find_options/0
-type find_options() :: #{mode => node | zipper, traverse => content | all}.
Link to this section Functions
Link to this function
code_zipper(Root)
-spec code_zipper(ktn_code:tree_node()) -> zipper:zipper(_).
Link to this function
code_zipper(Root, Mode)
-spec code_zipper(ktn_code:tree_node(), content | all) -> zipper:zipper(_).
Link to this function
exported_functions(_)
-spec exported_functions(ktn_code:tree_node()) -> [{atom(), integer()}].
Link to this function
find(Pred, Root)
-spec find(fun((zipper:zipper(_)) -> boolean()), ktn_code:tree_node()) -> [ktn_code:tree_node()].
#{mode => node, traverse => content}
as the options map.
Link to this function
find(Pred, Root, Opts)
-spec find(fun((zipper:zipper(_)) -> boolean()), ktn_code:tree_node(), find_options()) -> [ktn_code:tree_node()].
true
. The options map has two keys:- -
mode
: when the valuenode
is specified the predicate function receives a tree_node() as its argument. Whenzipper
is specified the argument is the zipper location for the current node. - -
traverse
: the valuecontent
indicates to only take into account nodes in the parent-child hierarchy. Whenall
is provided the nodes held in thenode_attrs
map are also taken into account in the search.
Link to this function
find_by_location(Root, Location)
-spec find_by_location(ktn_code:tree_node(), {integer(), integer()}) -> not_found | {ok, ktn_code:tree_node()}.
Link to this function
find_token(Root, Location)
-spec find_token(ktn_code:tree_node(), {integer(), integer()}) -> not_found | {ok, map()}.
Link to this function
function_names(_)
-spec function_names(ktn_code:tree_node()) -> [atom()].
Link to this function
module_name(_)
-spec module_name(ktn_code:tree_node()) -> atom().
Link to this function
past_nesting_limit(Node, MaxLevel)
-spec past_nesting_limit(ktn_code:tree_node(), integer()) -> [{ktn_code:tree_node(), integer()}].
Link to this function
print_node(Node)
-spec print_node(ktn_code:tree_node()) -> ok.
Link to this function
print_node(Node, CurrentLevel)
-spec print_node(ktn_code:tree_node(), integer()) -> ok.