Skip to content

Commit

Permalink
protocol_for_deps: support git:// alongside https://
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira committed Nov 11, 2024
1 parent 4b411cd commit cdd09a4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc_rules/elvis_project/protocol_for_deps.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This rule was called `protocol_for_deps_rebar` before
## Options

- `regex :: string()`.
- default: `(https://.*|[0-9]+([.][0-9]+)*)`.
- default: `^(https://|git://|\\d+(\\.\\d+)*)`.

## Example

Expand All @@ -21,5 +21,5 @@ This rule was called `protocol_for_deps_rebar` before
- since [2.0.0](https://github.com/inaka/elvis_core/releases/tag/2.0.0)

```erlang
{elvis_project, protocol_for_deps, #{ regex => "(https://.*|[0-9]+([.][0-9]+)*)" }}
{elvis_project, protocol_for_deps, #{ regex => "^(https://|git://|\\d+(\\.\\d+)*)" }}
```
2 changes: 1 addition & 1 deletion src/elvis_project.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
default(no_branch_deps) ->
#{ignore => []};
default(protocol_for_deps) ->
#{ignore => [], regex => "(https://.*|[0-9]+([.][0-9]+)*)"};
#{ignore => [], regex => "^(https://|git://|\\d+(\\.\\d+)*)"};
default(old_configuration_format) ->
#{}.

Expand Down
4 changes: 2 additions & 2 deletions test/examples/rebar.config.fail
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{deps_dir, "deps"}.
{deps,
[
{lager, "2.*", {git, "git://github.com/basho/lager.git", "2.0.0"}},
{lager, "2.*", {git, "git2://github.com/basho/lager.git", "2.0.0"}},
{getopt, "0.*", {git, "[email protected]:jcomellas/getopt.git", {branch, "main"}}},
{meck, "0.*", {git, "https://github.com/eproxus/meck.git", "0.8.2"}},
{jiffy, "0.*", {git, "https://github.com/davisp/jiffy.git", "0.11.3"}},
Expand All @@ -30,7 +30,7 @@
{aleppo, "0.*", {git, "https://github.com/inaka/aleppo.git", "main"}},
{jsx, {raw, {git, "[email protected]:talentdeficit.git", {branch, "develop"}}}},

{lager, {git, "git://github.com/basho/lager.git", "2.0.0"}},
{lager, {git, "git2://github.com/basho/lager.git", "2.0.0"}},
{getopt, {git, "[email protected]:jcomellas/getopt.git", {branch, "main"}}},
{meck, {git, "https://github.com/eproxus/meck.git", "0.8.2"}},
{jiffy, {git, "https://github.com/davisp/jiffy.git", "0.11.3"}},
Expand Down
4 changes: 2 additions & 2 deletions test/examples/rebar3_2.config.success
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
{rebar, "1.0.0"},
{rebar, {pkg, rebar_fork}},
{rebar, "1.0.0", {pkg, rebar_fork}},
{rebar, {git, "https://github.com/rebar/rebar.git", {branch, "main"}}},
{rebar, {git, "git://github.com/rebar/rebar.git", {branch, "main"}}},
{rebar, {git, "https://github.com/rebar/rebar.git", {tag, "1.0.0"}}},
{rebar, {git, "https://github.com/rebar/rebar.git", {ref, "7f73b8d6"}}},
{rebar, {hg, "https://github.com/rebar/rebar.git", {tag, "1.0.0"}}},
{rebar, {git_subdir, "https://github.com/rebar/rebar.git", {branch, "main"}, "subdir"}},
{rebar, {git_subdir, "https://github.com/rebar/rebar.git", {tag, "1.0.0"}, "sub/dir"}},
{rebar, {git_subdir, "git://github.com/rebar/rebar.git", {tag, "1.0.0"}, "sub/dir"}},
{rebar, {git_subdir, "https://github.com/rebar/rebar.git", {ref, "7f73b8d6"}, "dir"}},
%% Alternative formats, backwards compatible declarations
{rebar, {git, "https://github.com/rebar/rebar.git"}},
Expand Down

0 comments on commit cdd09a4

Please sign in to comment.