Module hank_utils

Utility functions.

Description

Utility functions

Function Index

application_node_to_mfa/1Returns a MFA tuple for given application node.
attr_args_concrete/2Same as attr_args/3 but calling erl_syntax:concrete/1 for each element.
attr_name/1Macro dodging version of erl_syntax:attribute_name/1.
format_text/2Format rule result text for console output.
function_description/1Get the function definition name and arity of a given Function Node.
function_name/1Get the function name of a given Function Node.
implements_behaviour/1Whether the given AST nodes list has behaviours implemented or not.
is_old_test_suite/1Before OTP 23.2 test suites implemented an _implicit_ behavior.
macro_arity/1Get the macro arity of given Node.
macro_definition_name/1Get the macro definition name and arity of a given Macro Node.
macro_name/1Get the parsed macro name of given Node.
node_has_atom/2Returns true if the noce contains the atom.
node_has_attrs/2Whether the given Node node has defined the given AttrNames attribute names or not.
node_line/1Returns the line number of the given node.
paths_match/2Whether one of the given paths is contained inside the other one or not.

Function Details

application_node_to_mfa/1

application_node_to_mfa(Node::erl_syntax:syntaxTree()) -> undefined | {unknown | string(), unknown | string(), [erl_syntax:syntaxTree()]} | {string(), [erl_syntax:syntaxTree()]}

Returns a MFA tuple for given application node

attr_args_concrete/2

attr_args_concrete(AST::erl_syntax:forms(), AttrName::atom() | [atom()]) -> [term()]

Same as attr_args/3 but calling erl_syntax:concrete/1 for each element

attr_name/1

attr_name(Node::erl_syntax:syntaxTree()) -> atom()

Macro dodging version of erl_syntax:attribute_name/1

format_text/2

format_text(Text::string(), Args::list()) -> binary()

Format rule result text for console output

function_description/1

function_description(Node::erl_syntax:syntaxTree()) -> string()

Get the function definition name and arity of a given Function Node.

function_name/1

function_name(Node::erl_syntax:syntaxTree()) -> string()

Get the function name of a given Function Node.

implements_behaviour/1

implements_behaviour(AST::erl_syntax:forms()) -> boolean()

Whether the given AST nodes list has behaviours implemented or not

is_old_test_suite/1

is_old_test_suite(File::file:filename()) -> boolean()

Before OTP 23.2 test suites implemented an _implicit_ behavior. The only way to figure out that a module was actually a test suite was by its name.

macro_arity/1

macro_arity(Node::erl_syntax:syntaxTree()) -> none | pos_integer()

Get the macro arity of given Node

macro_definition_name/1

macro_definition_name(Node::erl_syntax:syntaxTree()) -> {string(), integer() | atom()}

Get the macro definition name and arity of a given Macro Node.

macro_name/1

macro_name(Node::erl_syntax:syntaxTree()) -> string()

Get the parsed macro name of given Node

node_has_atom/2

node_has_atom(Node::erl_syntax:syntaxTree(), Atom::atom()) -> boolean()

Returns true if the noce contains the atom. Only analyzes functions and attributes.

node_has_attrs/2

node_has_attrs(Node::erl_syntax:syntaxTree(), AttrName::atom() | [atom()]) -> boolean()

Whether the given Node node has defined the given AttrNames attribute names or not

node_line/1

node_line(Node::erl_syntax:syntaxTree()) -> non_neg_integer()

Returns the line number of the given node

paths_match/2

paths_match(IncludePath::string(), X2::string()) -> boolean()

Whether one of the given paths is contained inside the other one or not. It doesn't matter which one is contained at which other. Verifies if FilePath and IncludePath refer both to the same file. Note that we can't just compare both filename:absname's here, since we don't really know what is the absolute path of the file referred by the include directive.


Generated by EDoc