Skip to content

Latest commit

 

History

History
182 lines (114 loc) · 4.75 KB

elvis_utils.md

File metadata and controls

182 lines (114 loc) · 4.75 KB

Module elvis_utils

Data Types


file() = #{path => string(), content => binary()}

line_content() = {integer(), integer()}

Function Index

check_lines/3Takes a binary that holds source code and applies Fun to each line.
check_lines_with_context/4Checks each line calling fun and providing the previous and next lines based on the context tuple {Before, After}.
check_nodes/3Takes a binary that holds source code and applies Fun to each line.
erlang_halt/1This is defined so that it can be mocked for tests.
error_prn/1
error_prn/2
indentation/3Takes a line, a character and a count, returning the indentation level invalid if the number of character is not a multiple of count.
info/1
info/2
notice/1
notice/2
parse_colors/1
to_str/1

Function Details

check_lines/3


check_lines(Src::binary(), Fun::function(), Args::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}.

check_lines_with_context/4


check_lines_with_context(Src::binary(), Fun::function(), Args::term(), Ctx::line_content()) -> [elvis_result:item()]

Checks each line calling fun and providing the previous and next lines based on the context tuple {Before, After}.

check_nodes/3


check_nodes(RootNode::ktn_code:tree_node(), Fun::function(), Args::[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}.

erlang_halt/1


erlang_halt(Code::integer()) -> no_return()

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

error_prn/1


error_prn(Message::string()) -> ok

error_prn/2


error_prn(Message::string(), Args::[term()]) -> ok

indentation/3


indentation(Line::binary() | string(), Char::char(), Count::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.

info/1


info(Message::string()) -> ok

info/2


info(Message::string(), Args::[term()]) -> ok

notice/1


notice(Message::string()) -> ok

notice/2


notice(Message::string(), Args::[term()]) -> ok

parse_colors/1


parse_colors(Message::string()) -> string()

to_str/1


to_str(Arg::binary() | list() | atom() | integer()) -> string()