Skip to content

Commit 6923a83

Browse files
Merge pull request #343 from inaka/fix/git_subdir-in-protocol_for_deps_rebar
Fix (`function_clause`) to support `git_subdir` in `protocol_for_deps_rebar`
2 parents 1c50c12 + 8571b87 commit 6923a83

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

src/elvis_project.erl

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ is_not_git_dep({_AppName, {_SCM, Url}}, Regex) ->
141141
is_not_git_dep({_AppName, _Vsn, {_SCM, Url}}, Regex) ->
142142
nomatch == re:run(Url, Regex, []);
143143
is_not_git_dep({_AppName, _Vsn, {_SCM, Url, _Branch}}, Regex) ->
144+
nomatch == re:run(Url, Regex, []);
145+
is_not_git_dep({_AppName, {git_subdir, Url, {branch, _Branch}, _SubDir}}, Regex) ->
144146
nomatch == re:run(Url, Regex, []).
145147

146148
%% @private

test/examples/rebar.config.fail

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
{jiffy, {git, "[email protected]:davisp/jiffy.git"}},
3838
{ibrowse, {git, "https://github.com/cmullaparthi/ibrowse.git", "v4.1.1"}},
3939
{aleppo, {git, "https://github.com/inaka/aleppo.git", "main"}},
40-
{jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "main"}}}}
40+
{jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "main"}}}},
41+
{opentelemetry_api, {git_subdir, "http://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry_api"}}
4142
]
4243
}.
4344
{escript_name, "elvis"}.

test/examples/rebar3.config.success

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
{meck, "0.8.2", {git, "https://github.com/basho/meck.git", {tag, "0.8.2"}}},
66
{jiffy, {git, "https://github.com/davisp/jiffy.git"}},
77
recon,
8-
{jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "develop"}}}}
8+
{jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "develop"}}}},
9+
{opentelemetry_api, {git_subdir, "https://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry_api"}}
910
]}.

test/project_SUITE.erl

+12-4
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,24 @@ verify_protocol_for_deps(_Config) ->
6060
Filename = "rebar.config.fail",
6161
{ok, File} = elvis_test_utils:find_file(SrcDirs, Filename),
6262

63-
[_, _, _, _, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, #{}),
63+
[#{info := [lager, _]},
64+
#{info := [getopt, _]},
65+
#{info := [jiffy, _]},
66+
#{info := [jsx, _]},
67+
#{info := [lager, _]},
68+
#{info := [getopt, _]},
69+
#{info := [jiffy, _]},
70+
#{info := [opentelemetry_api, _]}] =
71+
elvis_project:protocol_for_deps(ElvisConfig, File, #{}),
6472

6573
RuleConfig = #{ignore => [getopt, jsx]},
66-
[_, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig),
74+
[_, _, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig),
6775

6876
RuleConfig1 = #{ignore => [getopt, lager]},
69-
[_, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig1),
77+
[_, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig1),
7078

7179
RuleConfig2 = #{ignore => [meck], regex => "git@.*"},
72-
[_, _, _, _, _, _, _, _, _] =
80+
[_, _, _, _, _, _, _, _, _, _] =
7381
elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig2).
7482

7583
-spec verify_hex_dep(config()) -> any().

0 commit comments

Comments
 (0)