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/test/dialyzer_common.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/dialyzer/test') diff --git a/lib/dialyzer/test/dialyzer_common.erl b/lib/dialyzer/test/dialyzer_common.erl index 1a8403f486..beaf126344 100644 --- a/lib/dialyzer/test/dialyzer_common.erl +++ b/lib/dialyzer/test/dialyzer_common.erl @@ -147,7 +147,8 @@ check(TestCase, Opts, Dir, OutDir) -> try dialyzer:run([{files, Files},{from, src_code},{init_plt, PltFilename}, {check_plt, false}|ProperOpts]) of RawWarns -> - Warns = lists:sort([dialyzer:format_warning(W) || W <- RawWarns]), + Warns = lists:sort([dialyzer:format_warning(W, ProperOpts) || + W <- RawWarns]), case Warns of [] -> ok; _ -> -- cgit v1.2.3