elvis_file (elvis_core v5.0.3)

View Source

Summary

Functions

Returns the file encoding.

Filter files to those matching the globs and not matching any ignore regex.

Returns all files matching the given glob patterns.

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, Globs, IgnoreList)

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

Filter files to those matching the globs and not matching any ignore regex.

find_files(Globs)

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

Returns all files matching the given glob patterns.

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.