elvis_utils (elvis_core v2.0.0)

Link to this section Summary

Functions

Takes a binary that holds source code and applies Fun to each line. Fun takes 2 or 3 arguments (the line as a binary, the line number and the optional supplied Args) and returns 'no_result' or {'ok', Result}.
Checks each line calling fun and providing the previous and next lines based on the context tuple {Before, After}.
Takes a binary that holds source code and applies Fun to each line. Fun takes 3 arguments (the line as a binary, the line number and the supplied Args) and returns 'no_result' or {'ok', Result}.
This is defined so that it can be mocked for tests.
Takes a line, a character and a count, returning the indentation level invalid if the number of character is not a multiple of count.

Link to this section Types

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

line_content/0

-type line_content() :: {integer(), integer()}.

Link to this section Functions

Link to this function

check_lines(Src, Fun, Args)

-spec check_lines(binary(), fun(), term()) -> [elvis_result:item()].
Takes a binary that holds source code and applies Fun to each line. Fun takes 2 or 3 arguments (the line as a binary, the line number and the optional supplied Args) and returns 'no_result' or {'ok', Result}.
Link to this function

check_lines_with_context(Src, Fun, Args, Ctx)

-spec check_lines_with_context(binary(), fun(), term(), line_content()) -> [elvis_result:item()].
Checks each line calling fun and providing the previous and next lines based on the context tuple {Before, After}.
Link to this function

check_nodes(RootNode, Fun, Args)

-spec check_nodes(ktn_code:tree_node(), fun(), [term()]) -> [elvis_result:item()].
Takes a binary that holds source code and applies Fun to each line. Fun takes 3 arguments (the line as a binary, the line number and the supplied Args) and returns 'no_result' or {'ok', Result}.
Link to this function

erlang_halt(Code)

-spec erlang_halt(integer()) -> no_return().
This is defined so that it can be mocked for tests.
-spec error(string()) -> ok.
Link to this function

error(Message, Args)

-spec error(string(), [term()]) -> ok.
Link to this function

error_prn(Message)

-spec error_prn(string()) -> ok.
Link to this function

error_prn(Message, Args)

-spec error_prn(string(), [term()]) -> ok.
Link to this function

indentation(Line, Char, Count)

-spec indentation(binary() | string(), char(), integer()) -> invalid | integer().
Takes a line, a character and a count, returning the indentation level invalid if the number of character is not a multiple of count.
-spec info(string()) -> ok.
Link to this function

info(Message, Args)

-spec info(string(), [term()]) -> ok.
Link to this function

notice(Message)

-spec notice(string()) -> ok.
Link to this function

notice(Message, Args)

-spec notice(string(), [term()]) -> ok.
Link to this function

parse_colors(Message)

-spec parse_colors(string()) -> string().
Link to this function

split_all_lines(Binary)

-spec split_all_lines(binary()) -> [binary(), ...].
Link to this function

split_all_lines(Binary, Opts)

-spec split_all_lines(binary(), list()) -> [binary()].
-spec to_str(binary() | list() | atom() | integer()) -> string().
Link to this function

warn_prn(Message, Args)

-spec warn_prn(string(), [term()]) -> ok.