From b0a7495c44ebf6741714948bdf5c0cb9593ec953 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Fri, 15 Mar 2019 15:45:28 +0100 Subject: dialyzer: Add an --no_indentation option By default Dialyzer tries to improve the readability of warnings. Newlines are inserted before and inside types, signatures, and Erlang code. Sometimes the newlines look misplaced. The raw format (option --raw) is not affected. Use the new --no_indentation option get the old behavior (no inserted line breaks). A note on the implementation. The types &c present in the warning tuples are parsed, and then formatted using erl_pp, the Erlang Pretty Printer. The alternative, to create message tuples with formatted types, turned out to more complicated, and has no real benefits. Also notice that the fixes for binaries (commit 9db8a098) and union elements (commit a1e51d12) are required. As a consequence, messages created before these commits using the --raw option cannot always be indented. --- lib/dialyzer/src/dialyzer_gui_wx.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/dialyzer/src/dialyzer_gui_wx.erl') diff --git a/lib/dialyzer/src/dialyzer_gui_wx.erl b/lib/dialyzer/src/dialyzer_gui_wx.erl index b8414b7d8b..f47d90b91f 100644 --- a/lib/dialyzer/src/dialyzer_gui_wx.erl +++ b/lib/dialyzer/src/dialyzer_gui_wx.erl @@ -1135,7 +1135,9 @@ handle_help(State, Title, Txt) -> add_warnings(#gui_state{warnings_box = WarnBox, rawWarnings = RawWarns} = State, Warnings) -> NewRawWarns = RawWarns ++ Warnings, - WarnList = [dialyzer:format_warning(W) -- "\n" || W <- NewRawWarns], + %% The indentation cannot be turned off. + WarnList = [string:trim(dialyzer:format_warning(W), trailing) || + W <- NewRawWarns], wxListBox:set(WarnBox, WarnList), State#gui_state{rawWarnings = NewRawWarns}. -- cgit v1.2.3