Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Merge rebar aliases into analyzer #139

Merged
merged 2 commits into from
Sep 26, 2020
Merged

Merge rebar aliases into analyzer #139

merged 2 commits into from
Sep 26, 2020

Conversation

skilly-lily
Copy link
Contributor

Minor changes required for the config parser, including a newtype for safety.

@skilly-lily skilly-lily requested a review from zlav September 25, 2020 21:14

getAlias :: ErlValue -> Maybe (Text, Text)
getAlias erl = case erl of
ErlTuple [ErlAtom (AtomText realname), ErlString _, ErlTuple [ErlAtom (AtomText "pkg"), ErlAtom (AtomText alias)]] -> Just (realname, alias)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern match is a beast, but it actually seems like the most idiomatic thing. It's kind of a weird structure to find, functionally, so expressing it as-is seems to make sense.

Copy link
Member

@zlav zlav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I have a few small nits but other than that the alias logic looks good.

src/Strategy/Erlang/ConfigParser.hs Show resolved Hide resolved
ErlTuple [atom "number", ErlInt 5678] -- Literal
]]
ConfigValues
[ErlTuple [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Would it make sense to have multiple ErlTuple values in the ConfigValues array for the test now that we made that possible with the ConfigValues type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand. It already supports multiple ErlValues.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that makes sense, I was asking if we should modify the test values to contain multiple ErlValues so that we can test it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the real-life test already checks that. It fails if the parser doesn't sit just right. Check here

src/Strategy/Erlang/Rebar3Tree.hs Outdated Show resolved Hide resolved
src/Strategy/Erlang/Rebar3Tree.hs Outdated Show resolved Hide resolved
@skilly-lily
Copy link
Contributor Author

Merging without resolving nits. We can follow these up later @zlav

@skilly-lily skilly-lily merged commit e63665d into master Sep 26, 2020
@skilly-lily skilly-lily deleted the rebar3-config-merge branch November 18, 2020 18:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants