Module elvis_code

Data Types

find_options()

find_options() = #{mode => node | zipper, traverse => content | all}

Function Index

code_zipper/1
code_zipper/2
exported_functions/1Takes the root node of a parse_tree and returns name and arity of each exported function.
find/2Same as calling find/3 with #{mode => node, traverse => content} as the options map.
find/3Find all nodes in the tree for which the predicate function returns true.
find_by_location/2
find_token/2
function_names/1Takes the root node of a parse_tree and returns the name of each function, whether exported or not.
module_name/1Takes the root node and returns the module's name.
past_nesting_limit/2Takes a node and returns all nodes where the nesting limit is exceeded.
print_node/1Debugging utility function.
print_node/2

Function Details

code_zipper/1

code_zipper(Root::ktn_code:tree_node()) -> zipper:zipper(term())

code_zipper/2

code_zipper(Root::ktn_code:tree_node(), Mode::content | all) -> zipper:zipper(term())

exported_functions/1

exported_functions(X1::ktn_code:tree_node()) -> [{atom(), integer()}]

Takes the root node of a parse_tree and returns name and arity of each exported function.

find/2

find(Pred::fun((zipper:zipper(term())) -> boolean()), Root::ktn_code:tree_node()) -> [ktn_code:tree_node()]

Same as calling find/3 with #{mode => node, traverse => content} as the options map.

find/3

find(Pred::fun((zipper:zipper(term())) -> boolean()), Root::ktn_code:tree_node(), Opts::find_options()) -> [ktn_code:tree_node()]

Find all nodes in the tree for which the predicate function returns true. The options map has two keys:

find_by_location/2

find_by_location(Root::ktn_code:tree_node(), Location::{integer(), integer()}) -> not_found | {ok, ktn_code:tree_node()}

find_token/2

find_token(Root::ktn_code:tree_node(), Location::{integer(), integer()}) -> not_found | {ok, map()}

function_names/1

function_names(X1::ktn_code:tree_node()) -> [atom()]

Takes the root node of a parse_tree and returns the name of each function, whether exported or not.

module_name/1

module_name(X1::ktn_code:tree_node()) -> atom()

Takes the root node and returns the module's name.

past_nesting_limit/2

past_nesting_limit(Node::ktn_code:tree_node(), MaxLevel::integer()) -> [{ktn_code:tree_node(), integer()}]

Takes a node and returns all nodes where the nesting limit is exceeded.

print_node/1

print_node(Node::ktn_code:tree_node()) -> ok

Debugging utility function.

print_node/2

print_node(Node::ktn_code:tree_node(), CurrentLevel::integer()) -> ok


Generated by EDoc