Browse Source

Fix output issue (bug) when `dialyzer.warnings.unknown` is used in `rebar.config`

... and e.g. an unknown type is detected
pull/2351/head
Paulo F. Oliveira 4 years ago
parent
commit
573906513f
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      src/rebar_dialyzer_format.erl

+ 15
- 0
src/rebar_dialyzer_format.erl View File

@ -27,6 +27,21 @@ format_warnings(Opts, Warnings) ->
%% If the last seen file is and the file of this warning are the same
%% `dialyzer_cl` returns _Filename = "", _Line = 0 for `unknown`
format_warning_(_Opts, Warning = {_Tag, {"" = _SrcFile0, 0 = Line}, Msg}, {_LastFile, Acc}) ->
SrcFile = "<path unknown>",
try
F = fmt("~!_c~ts", [SrcFile]),
String = message_to_string(Msg),
{SrcFile, [lists:flatten(fmt("~n~ts~n~!c~4w~!!: ~ts", [F, Line, String])) | Acc]}
catch
?WITH_STACKTRACE(Error, Reason, Stacktrace)
?DEBUG("Failed to pretty format warning: ~p:~p~n~p",
[Error, Reason, Stacktrace]),
{SrcFile, [dialyzer:format_warning(Warning, fullpath) | Acc]}
end;
%% we skip the file header
format_warning_(_Opts, Warning = {_Tag, {File, Line}, Msg}, {File, Acc}) ->
try

Loading…
Cancel
Save