Fix crash in warning message generation and bug in reporting #144
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I can demonstrate the below bugs on C-S-D/retort@8afabf4bb2e04ef83a27a820fff772394cee3883 if you need something to test this against for verification.
Changelog
Bug Fixes
add_message
callsAgent.update
, which always returns:ok
, so it doesn't make sense to use the return value for the newoptions1
in_parse
. Since both paths shouldn't alteroptions
, have thecase
only be run for side-effect of add_message call.Fixes this error
The
Agent
's state inEarmark.Global.Messages
is never reset, so once a line has a warning it has that warning for all subsequent files. Sinceget_all_messages()
is never called twice to report the same warnings intentionally,get_all_messages
can be changed topop_all_messages
, so it gets the messages as before, but also resets the state, in preparation for the next call.This fixes errors like
where the only the first warning is real, but it is reported on all
following files.
Incompatible Changes
Earmark.Global.Messages.get_all_messages/0
is replaced byEarmark.Global.Messages.pop_all_messages/0
to prevent leaking messages between files.