diff --git a/src/elvis.app.src b/src/elvis.app.src index be33066..4d2be51 100644 --- a/src/elvis.app.src +++ b/src/elvis.app.src @@ -2,7 +2,7 @@ application, elvis, [ {description, "Erlang Style Reviewer, inspired on HoundCI"}, - {vsn, "0.2.5"}, + {vsn, "0.2.6-alpha1"}, {applications, [kernel, stdlib, ibrowse, ssl, jiffy, lager, aleppo, zipper]}, {modules, [ diff --git a/src/elvis_config.erl b/src/elvis_config.erl index c54b124..ca6ac04 100644 --- a/src/elvis_config.erl +++ b/src/elvis_config.erl @@ -108,7 +108,7 @@ dirs(#{}) -> filter(_RuleGroup = #{filter := Filter}) -> Filter; filter(#{}) -> - undefined. + ?DEFAULT_FILTER. -spec files(config()) -> [string()]. files(_RuleGroup = #{files := Files}) -> @@ -130,14 +130,10 @@ rules(#{}) -> resolve_files(Config, Files) when is_list(Config) -> Fun = fun(RuleGroup) -> resolve_files(RuleGroup, Files) end, lists:map(Fun, Config); -resolve_files(RuleGroup = #{filter := Filter}, Files) -> +resolve_files(RuleGroup, Files) -> Filter = filter(RuleGroup), Dirs = dirs(RuleGroup), FilteredFiles = elvis_file:filter_files(Files, Dirs, Filter), - RuleGroup#{files => FilteredFiles}; -resolve_files(RuleGroup, Files) -> - Dirs = dirs(RuleGroup), - FilteredFiles = elvis_file:filter_files(Files, Dirs, ?DEFAULT_FILTER), RuleGroup#{files => FilteredFiles}. %% @doc Takes a configuration and finds all files according to its 'dirs' diff --git a/test/elvis_SUITE.erl b/test/elvis_SUITE.erl index 6429b42..3b37aa6 100644 --- a/test/elvis_SUITE.erl +++ b/test/elvis_SUITE.erl @@ -199,11 +199,17 @@ run_webhook(_Config) -> elvis:start(), meck:new(egithub, [passthrough]), - FakeFun1 = fun(_, _, _) -> {ok, []} end, + Files = [#{<<"filename">> => <<"test/examples/rebar.config.fail">>}], + FakeFun1 = fun(_, _, _) -> {ok, Files} end, meck:expect(egithub, pull_req_files, FakeFun1), - meck:expect(egithub, pull_req_comments, FakeFun1), - meck:expect(egithub, issue_comments, FakeFun1), - FakeFun2 = fun(_, _, _, _) -> {error, error} end, + + EmptyResultFun = fun(_, _, _) -> {ok, []} end, + meck:expect(egithub, pull_req_comments, EmptyResultFun), + meck:expect(egithub, issue_comments, EmptyResultFun), + + FakeFun2 = fun(_, _, _, "elvis.config") -> + {error, error} + end, meck:expect(egithub, file_content, FakeFun2), ok = elvis:webhook(Request)