rebar3 icon indicating copy to clipboard operation
rebar3 copied to clipboard

[Enchancement] Improve failure message when deps section of rebar.config is improperly configured

Open sanzor opened this issue 2 years ago • 1 comments

I misproperly configured the deps section of rebar.config the following way:

{git,"https://www.github.com/sanzor/bankingapp.git",{branch,"master"}} instead of : {rebar,{git,"https://www.github.com/sanzor/bankingapp.git",{branch,"master"}}}

Current behaviour

I am getting this error message , and i stood quite a while thinking that somehow the branch or the repo were wrong or couldn't get fetched from the source (source was bad). It turned out the problem was the format of the dependency , i didn't add the rebar keyword like above.

===> Failed to fetch and copy dep: {branch,"master"}

Expected behaviour

I would've expected that if there is a problem regarding a typo , or not respecting the standard i would get notified. For a new guy like me i could literally lose (and i did) days upon days for something this "small".

Could this kind of conventions that one must follow in rebar.config or .config or .src files , be more throughly enforced or at least highlighted when not respected ?

P.S It is my first post here and i would've wanted to add a label like "improvement/suggestion" but i do not know how. If someone is kind enough to edit my post , or tell me how to do it i would be grateful !

sanzor avatar Apr 27 '22 20:04 sanzor

This is a bit tricky, because plugins could very well support this format.

For example, A format supported is {uuid, "1.0.0", {pkg, uuid_erl}} means to fetch the uuid_erl package on hex.pm at version 1.0.0, under the app name uuid. So what we get here is a bad format that gets tunnel through as supported formats. What happens here is that someone could define a plugin handling resources of a type branch with a resource named "master" that would represent the Erlang application git.

So specifically, forbidding this format could drop legitimate plugin formats, and we can't too easily forbid it. We could theoretically catch the error, but this is not really obvious :(

ferd avatar Apr 27 '22 22:04 ferd