elvis_file (elvis_core v2.0.0)

Link to this section Summary

Functions

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 .erl/.beam file
Add the root node of the parse tree to the file data.
Add the root node of the parse tree to the file data, with filtering.
Given a file() returns its path.
Returns a tuple with the contents of the file and the file itself.

Link to this section Types

-type file() :: #{path => string(), content => binary(), _ => _}.

Link to this section Functions

Link to this function

filter_files(Files, Dirs, Filter, IgnoreList)

-spec filter_files([file()], [string()], string(), [string()]) -> [file()].
Filter files based on the glob provided.
Link to this function

find_files(Dirs, Pattern)

-spec find_files([string()], string()) -> [file()].
Returns all files under the specified Path that match the pattern Name.
Link to this function

load_file_data(Config, File0)

-spec load_file_data(elvis_config:configs() | elvis_config:config(), file()) -> file().
Loads and adds all related file data.
-spec module(file()) -> module().
Return module name corresponding to a given .erl/.beam file
Link to this function

parse_tree(Config, Target)

-spec parse_tree(elvis_config:configs() | elvis_config:config(), file()) ->
              {ktn_code:tree_node(), file()}.
Add the root node of the parse tree to the file data.
Link to this function

parse_tree(Config, File, RuleConfig)

Add the root node of the parse tree to the file data, with filtering.
-spec path(file()) -> string().
Given a file() returns its path.
-spec src(file()) -> {binary(), file()} | {error, enoent}.
Returns a tuple with the contents of the file and the file itself.