elvis_file (elvis_core v4.2.0)

View Source

Summary

Functions

Returns the file encoding.

Filter files based on the glob provided.

Returns all files under the specified Path that match the pattern Name.

Loads and adds all related file data.

Return module name corresponding to a given .hrl/.erl/.beam file

Add the root node of the parse tree to the file data, with filtering.

Given a t() returns its path.

Returns a tuple with the contents of the file and the file itself.

Types

t/0

-opaque t()

Functions

encoding(_)

-spec encoding(t()) -> atom().

Returns the file encoding.

filter_files(Files, Dirs, Filter, IgnoreList)

-spec filter_files([t()], [string()], string(), [string()]) -> [t()].

Filter files based on the glob provided.

find_files(Dirs, Pattern)

-spec find_files([string()], string()) -> [t()].

Returns all files under the specified Path that match the pattern Name.

get_abstract_parse_tree(File)

-spec get_abstract_parse_tree(t()) -> ktn_code:tree_node().

load_file_data(ElvisConfig, File0)

-spec load_file_data([elvis_config:t()] | elvis_config:t(), t()) -> t().

Loads and adds all related file data.

module(_)

-spec module(t()) -> module().

Return module name corresponding to a given .hrl/.erl/.beam file

parse_tree(File, ElvisConfig)

-spec parse_tree(elvis_rule:t() | elvis_file:t(), [elvis_config:t()] | elvis_config:t()) ->
                    {ktn_code:tree_node(), t()}.

Add the root node of the parse tree to the file data, with filtering.

path(File)

-spec path(t()) -> string().

Given a t() returns its path.

src(File)

-spec src(t()) -> {binary(), t()} | {error, enoent}.

Returns a tuple with the contents of the file and the file itself.