View Source elvis_utils (elvis_core v3.2.5)

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.

Types

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

Functions

Link to this function

check_lines(Src, Fun, Args)

View Source
-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)

View Source
-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)

View Source
-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}.

-spec erlang_halt(integer()) -> no_return().

This is defined so that it can be mocked for tests.

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

error_prn(Message, Args)

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

indentation(Line, Char, Count)

View Source
-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.
-spec info(string(), [term()]) -> ok.
-spec notice(string()) -> ok.
-spec notice(string(), [term()]) -> ok.
-spec parse_colors(string()) -> string().
-spec split_all_lines(binary()) -> [binary(), ...].
Link to this function

split_all_lines(Binary, Opts)

View Source
-spec split_all_lines(binary(), list()) -> [binary()].
-spec to_str(binary() | list() | atom() | integer()) -> string().
-spec warn_prn(string(), [term()]) -> ok.