Closed g-andrade closed 3 years ago
The crash is happening right here, presumably because ConfigTuples
is not a list.
Therefore the fix looks superficially easy, but that depends on what counts as a valid .config
file. Is it anything that file:consult/1
can parse? Or is its definition stricter?
Is it anything that file:consult/1 can parse? Or is its definition stricter?
The documentation doesn't explicitly restrict it, but it does sort of suggest it's the latter.
So it's possible I should just not use .config
as an extension in my use case, albeit at some inconvenience (I've got Erlang syntax highlighting setup for it.)
What do you think?
I think Hank should just ignore files that can't be properly parsed.
But I also think that using a different extension in your case will help you reduce the number of potential issues with different tools that (maybe incorrectly) assume that all .config
files are formatted as sys.config
(like Hank and rebar3_format
, for instance).
Will be fixed in next release, @g-andrade. Thanks for spotting the issue!
👍 Thanks for the quick response!
(Great lib, by the way!)
Bug Description
I've got this
.config
file containing a map (in Erlang syntax) and a.
at the end.file:consult/1
can read it fine but Hank crashes when validatingunused_configuration_options
To Reproduce
crash.config
, with content#{foobar => 3.14}.
, under a project that usesrebar_hank
(sorry for the extra work, GitHub does not allow.config
files to be attached)rebar3 hank
on said project and confirm the crashfile:consult("crash.config")
succeeds by comparisonExpected Behavior
I expected it to not crash (but nothing in particular beyond that, as I was unaware of the
unused_configuration_options
check until this happened.)rebar3
Logshank crash log.txt
Additional Context
rebar3_hank
version: 1.1.4