From 649c7eeaddf39a906d93df9cb5b646a1959cc43f Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Wed, 22 May 2024 20:24:23 +0100 Subject: [PATCH 1/2] Have it fail... --- test/examples/rebar3.config.success | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/examples/rebar3.config.success b/test/examples/rebar3.config.success index 63e40dfb..f7862062 100644 --- a/test/examples/rebar3.config.success +++ b/test/examples/rebar3.config.success @@ -5,5 +5,6 @@ {meck, "0.8.2", {git, "https://github.com/basho/meck.git", {tag, "0.8.2"}}}, {jiffy, {git, "https://github.com/davisp/jiffy.git"}}, recon, - {jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "develop"}}}} + {jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "develop"}}}}, + {opentelemetry_api, {git_subdir, "https://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry_api"}} ]}. From 8571b87c9b84e7af3bde76c2d919cbdec729a81d Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Wed, 22 May 2024 20:41:59 +0100 Subject: [PATCH 2/2] ... to have it fixed We add a couple of text to the project_SUITE to have the issue more apparent --- src/elvis_project.erl | 2 ++ test/examples/rebar.config.fail | 3 ++- test/project_SUITE.erl | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/elvis_project.erl b/src/elvis_project.erl index 47b7b79b..7efb0fd5 100644 --- a/src/elvis_project.erl +++ b/src/elvis_project.erl @@ -141,6 +141,8 @@ is_not_git_dep({_AppName, {_SCM, Url}}, Regex) -> is_not_git_dep({_AppName, _Vsn, {_SCM, Url}}, Regex) -> nomatch == re:run(Url, Regex, []); is_not_git_dep({_AppName, _Vsn, {_SCM, Url, _Branch}}, Regex) -> + nomatch == re:run(Url, Regex, []); +is_not_git_dep({_AppName, {git_subdir, Url, {branch, _Branch}, _SubDir}}, Regex) -> nomatch == re:run(Url, Regex, []). %% @private diff --git a/test/examples/rebar.config.fail b/test/examples/rebar.config.fail index abb398c9..f39e7bf2 100644 --- a/test/examples/rebar.config.fail +++ b/test/examples/rebar.config.fail @@ -37,7 +37,8 @@ {jiffy, {git, "git@github.com:davisp/jiffy.git"}}, {ibrowse, {git, "https://github.com/cmullaparthi/ibrowse.git", "v4.1.1"}}, {aleppo, {git, "https://github.com/inaka/aleppo.git", "main"}}, - {jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "main"}}}} + {jsx, {raw, {git, "https://github.com/talentdeficit.git", {branch, "main"}}}}, + {opentelemetry_api, {git_subdir, "http://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry_api"}} ] }. {escript_name, "elvis"}. diff --git a/test/project_SUITE.erl b/test/project_SUITE.erl index ae0de5dc..4980e9c6 100644 --- a/test/project_SUITE.erl +++ b/test/project_SUITE.erl @@ -60,16 +60,24 @@ verify_protocol_for_deps(_Config) -> Filename = "rebar.config.fail", {ok, File} = elvis_test_utils:find_file(SrcDirs, Filename), - [_, _, _, _, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, #{}), + [#{info := [lager, _]}, + #{info := [getopt, _]}, + #{info := [jiffy, _]}, + #{info := [jsx, _]}, + #{info := [lager, _]}, + #{info := [getopt, _]}, + #{info := [jiffy, _]}, + #{info := [opentelemetry_api, _]}] = + elvis_project:protocol_for_deps(ElvisConfig, File, #{}), RuleConfig = #{ignore => [getopt, jsx]}, - [_, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig), + [_, _, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig), RuleConfig1 = #{ignore => [getopt, lager]}, - [_, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig1), + [_, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig1), RuleConfig2 = #{ignore => [meck], regex => "git@.*"}, - [_, _, _, _, _, _, _, _, _] = + [_, _, _, _, _, _, _, _, _, _] = elvis_project:protocol_for_deps(ElvisConfig, File, RuleConfig2). -spec verify_hex_dep(config()) -> any().