Skip to content

Commit

Permalink
elbrujohalcon.571.update-deps Apply new elvis rules
Browse files Browse the repository at this point in the history
  • Loading branch information
elbrujohalcon committed Aug 3, 2023
1 parent a105332 commit 11c17df
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 19 deletions.
4 changes: 0 additions & 4 deletions elvis.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
filter => "*.erl",
ruleset => erl_files
},
#{dirs => ["."],
filter => "Makefile",
ruleset => makefiles
},
#{dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config
Expand Down
4 changes: 2 additions & 2 deletions src/elvis.erl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ process_options([{parallel, Num} | Opts], Cmds, Config) ->
process_options([], Cmds, Config) ->
process_commands(Cmds, Config).

-spec process_commands([string()], elvis_config:configs()) ->ok.
-spec process_commands([string()], elvis_config:configs()) -> ok.
process_commands([rock | Files], Config) ->
case Files of
[] ->
Expand All @@ -168,7 +168,7 @@ process_commands(['git-branch', Commit | Cmds], Config) ->
process_commands([], _Config) ->
ok;
process_commands([_Cmd | _Cmds], _Config) ->
throw(unrecognized_or_unimplemented_command).
error(unrecognized_or_unimplemented_command).

%%% Options

Expand Down
6 changes: 3 additions & 3 deletions src/elvis_git.erl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ install_hook() ->
check_git_dir() ->
case filelib:is_dir(".git") of
true -> ok;
false -> throw("Not a git repository.")
false -> error("Not a git repository.")
end.

%% @doc Adds elvis as a pre commit hook. If a pre-commit file already exists
Expand All @@ -123,7 +123,7 @@ add_pre_commit_hook() ->
{ok, Content} = file:read_file(?PRE_COMMIT_FILE),
case binary:match(Content, <<"elvis">>) of
nomatch -> {[append], Command};
_ -> throw("Elvis is already installed as a git hook.")
_ -> error("Elvis is already installed as a git hook.")
end;
false -> {[write], <<Header/binary, Command/binary>>}
end,
Expand Down Expand Up @@ -155,7 +155,7 @@ patch_line_type(Line) ->
$+ -> addition;
$- -> deletion;
$\\ -> same;
$ -> same %space
$\s -> same %space
end.

%% @private
Expand Down
6 changes: 2 additions & 4 deletions src/elvis_webhook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ handle_pull_request(Cred, Data, GithubFiles) ->
comments => []}}
end.

-spec handle_error( {error, term()}
, egithub_webhook:req_data()
, [egithub_webhook:file()]
) -> {ok, [], []}.
-spec handle_error(
{error, term()}, egithub_webhook:req_data(), [egithub_webhook:file()]) -> {ok, [], []}.
handle_error({error, _}, _, _) -> {ok, [], []}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
5 changes: 3 additions & 2 deletions test/elvis_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
end_per_suite
]).

-type config() :: [{atom(), term()}].
-type config() :: proplists:proplist().
-export_type([config/0]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Common test
Expand Down Expand Up @@ -240,7 +241,7 @@ main_default_config(_Config) ->
meck:expect(elvis_utils, erlang_halt, fun(Code) -> Code end),
Src = "../../config/elvis-test.config",
Dest = "./elvis.config",
{ok , _} = file:copy(Src, Dest),
{ok, _} = file:copy(Src, Dest),

Expected = "# ../../src/elvis.erl.*OK",
RockFun = fun() -> elvis:main("rock") end,
Expand Down
4 changes: 2 additions & 2 deletions test/elvis_meta_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-module(elvis_meta_SUITE).
-author('[email protected]').

-export([all/0]).
-export([dialyzer/1, xref/1, elvis/1]).

-type config() :: [{atom(), term()}].
-type config() :: proplists:proplist().
-export_type([config/0]).

-spec all() -> [dialyzer | xref | elvis].
all() -> [dialyzer, xref, elvis].
Expand Down
4 changes: 2 additions & 2 deletions test/git_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
end_per_suite
]).

-type config() :: [{atom(), term()}].
-type config() :: proplists:proplist().
-export_type([config/0]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Common test
Expand Down Expand Up @@ -129,4 +130,3 @@ maybe_git_config_user() ->
_ = os:cmd("git config user.name 'Your Name'"),
ok
end.

1 change: 1 addition & 0 deletions test/xref_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-module(xref_SUITE).

-type config() :: proplists:proplist().
-export_type([config/0]).

-export(
[
Expand Down

0 comments on commit 11c17df

Please sign in to comment.