Skip to content

Commit

Permalink
Merge pull request #160 from paulo-ferraz-oliveira/fix/elvis
Browse files Browse the repository at this point in the history
Fix elvis
  • Loading branch information
elbrujohalcon authored Dec 3, 2020
2 parents 0e806c5 + f2e9fce commit 62e71c7
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 92 deletions.
37 changes: 3 additions & 34 deletions elvis.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,15 @@
{config,
[#{dirs => ["src", "test"],
filter => "*.erl",
rules => [{elvis_style, line_length, #{limit => 80,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 25}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call, #{ignore => [ktn_recipe_verify]}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{
elvis_style,
function_naming_convention,
#{regex => "^([a-z$][a-z0-9]*_?)*$"}
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records},
ruleset => erl_files,
rules => [{elvis_style, invalid_dynamic_call, #{ignore => [ktn_recipe_verify]}},
{elvis_style, dont_repeat_yourself, #{min_complexity => 15}},
{elvis_style, no_debug_call, #{debug_functions => [{ct, pal}]}}
]
},
#{dirs => ["."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk},
{elvis_project, protocol_for_deps_erlang_mk, #{regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}]
},
#{dirs => ["."],
filter => "elvis.config",
rules => [{elvis_project, old_configuration_format}]
ruleset => elvis_config
}
]
}
Expand Down
16 changes: 7 additions & 9 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

{profiles, [
{test, [
{deps, [{xref_runner, "1.0.0"}]}
{erl_opts, [nowarn_missing_spec]},
{deps, [{xref_runner, "1.0.0"}]},
{dialyzer, [{plt_extra_apps, [common_test, dialyzer, elvis, tools, xref_runner]}]}
]}
]}.

Expand Down Expand Up @@ -54,16 +56,12 @@

%% == Dependencies ==

{deps, [{elvis, "0.3.9", {pkg, elvis_core}}]}.
{project_plugins, [{rebar3_lint, "0.2.0"}]}.

%% == Dialyzer ==

{dialyzer, [ {warnings, [ no_return
, unmatched_returns
{dialyzer, [ {warnings, [ unmatched_returns
, error_handling
, unknown
]}
, {plt_apps, top_level_deps}
, {plt_extra_apps, []}
, {plt_location, local}
, {base_plt_apps, [stdlib, kernel]}
, {base_plt_location, global}]}.
, {plt_extra_apps, [tools]}]}.
18 changes: 10 additions & 8 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{"1.1.0",
[{<<"aleppo">>,{pkg,<<"inaka_aleppo">>,<<"1.0.0">>},2},
{<<"elvis">>,{pkg,<<"elvis_core">>,<<"0.3.9">>},0},
{<<"katana_code">>,{pkg,<<"katana_code">>,<<"0.1.0">>},1},
{"1.2.0",
[{<<"elvis">>,{pkg,<<"elvis_core">>,<<"0.7.0">>},0},
{<<"katana_code">>,{pkg,<<"katana_code">>,<<"0.2.1">>},1},
{<<"zipper">>,{pkg,<<"zipper">>,<<"1.0.1">>},1}]}.
[
{pkg_hash,[
{<<"aleppo">>, <<"8DB14CF16BB8C263C14FF4C3F69F64D7C849D40888944F4204D2CA74F1114CEB">>},
{<<"elvis">>, <<"6B3C18E1E1CC9BC5684282F59A95B6B42898C1A27E0E2F3CFE9B384AF76A7629">>},
{<<"katana_code">>, <<"C34F3926A258D6BEACD8D21F140F3D47D175501936431C460B144339D5271A0B">>},
{<<"zipper">>, <<"3CCB4F14B97C06B2749B93D8B6C204A1ECB6FAFC6050CACC3B93B9870C05952A">>}]}
{<<"elvis">>, <<"796E0FA68BB4C4D90FF67ED05F4B47947C9B4E1AB73711BA4168ACC96433A08E">>},
{<<"katana_code">>, <<"B2195859DF57D8BEBF619A9FD3327CD7D01563A98417156D0F4C5FAB435F2630">>},
{<<"zipper">>, <<"3CCB4F14B97C06B2749B93D8B6C204A1ECB6FAFC6050CACC3B93B9870C05952A">>}]},
{pkg_hash_ext,[
{<<"elvis">>, <<"9724B30EBF02608881D3F5A7AF397B0047927F26A31A17B08E45D5C883E08020">>},
{<<"katana_code">>, <<"8448AD3F56D9814F98A28BE650F7191BDD506575E345CC16D586660B10F6E992">>},
{<<"zipper">>, <<"6A1FD3E1F0CC1D1DF5642C9A0CE2178036411B0A5C9642851D1DA276BD737C2D">>}]}
].
8 changes: 1 addition & 7 deletions src/ktn_debug.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
-module(ktn_debug).

-export(
[ ppst/0
, ppst/1
[ ppst/1
]).

-spec ppst() ->
[any()].
ppst() ->
ppst(erlang:get_stacktrace()).

-spec ppst([any()]) ->
[any()].
ppst(StackTrace) ->
Expand Down
2 changes: 1 addition & 1 deletion src/ktn_os.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ shell_cmd() -> "/bin/sh -s unix:cmd".
%% DOWN message is after them all.
flush_until_down(Port, MonRef) ->
receive
{Port, {data, Bytes}} ->
{Port, {data, _Bytes}} ->
flush_until_down(Port, MonRef);
{'DOWN', MonRef, _, _, _} ->
flush_exit(Port)
Expand Down
3 changes: 3 additions & 0 deletions src/ktn_recipe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
-type transitions() :: [step()].
-type normalized_transitions() :: [transition()].

-export_type([transitions/0]).
-export_type([normalized_transitions/0]).

-callback transitions() -> transitions().
-callback process_result(term()) -> term().
-callback process_error(term()) -> term().
Expand Down
35 changes: 5 additions & 30 deletions test/elvis.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,21 @@
{config,
[#{dirs => ["../../src", "../../test"],
filter => "*.erl",
rules => [{elvis_style, line_length, #{limit => 80,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 25}},
{elvis_style, no_if_expression},
ruleset => erl_files,
rules => [
{elvis_style, invalid_dynamic_call, #{ignore => [ktn_recipe_verify]}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{
elvis_style,
function_naming_convention,
#{regex => "^([a-z$][a-z0-9]*_?)*$"}
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 15}},
{elvis_style, no_debug_call, #{debug_functions => [{ct, pal}]}}
]
},
#{dirs => ["../.."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => []}},
{elvis_project, protocol_for_deps_erlang_mk, #{ regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}]
ruleset => makefiles,
rules => [{elvis_project, protocol_for_deps_erlang_mk, #{ regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}]
},
#{dirs => ["../.."],
filter => "elvis.config",
rules => [{elvis_project, old_configuration_format}]
ruleset => elvis_config
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions test/ktn_meta_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ elvis(Config) ->
false -> filename:join(BaseDir, "elvis.config")
end,
[ fix_dirs(Group, Config)
|| Group <- elvis_config:load_file(ConfigFile)];
ConfigFile -> elvis_config:load_file(ConfigFile)
|| Group <- elvis_config:from_file(ConfigFile)];
ConfigFile -> elvis_config:from_file(ConfigFile)
end,

ct:comment("Elvis rocks!"),
Expand Down
2 changes: 1 addition & 1 deletion test/ktn_os_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ command(_Config) ->
Result = Cwd ++ "\n",
{0, Result} = ktn_os:command("pwd", Opts),

{1, _} = ktn_os:command("pwd; ls w4th3v3r", Opts),
{2, _} = ktn_os:command("pwd; ls w4th3v3r", Opts),

Result2 = Result ++ "Hi\n",
{0, Result2} = ktn_os:command("pwd; echo Hi", #{}),
Expand Down

0 comments on commit 62e71c7

Please sign in to comment.