diff options
author | Hans Bolinder <[email protected]> | 2019-03-15 15:45:28 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-05-07 08:24:37 +0200 |
commit | b0a7495c44ebf6741714948bdf5c0cb9593ec953 (patch) | |
tree | 41293e782e3b08e26caf4f5634936b6ba84ec3a1 /lib/dialyzer/doc | |
parent | a1e51d125944ad840a306d0cddec681848808f4c (diff) | |
download | otp-b0a7495c44ebf6741714948bdf5c0cb9593ec953.tar.gz otp-b0a7495c44ebf6741714948bdf5c0cb9593ec953.tar.bz2 otp-b0a7495c44ebf6741714948bdf5c0cb9593ec953.zip |
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.
Diffstat (limited to 'lib/dialyzer/doc')
-rw-r--r-- | lib/dialyzer/doc/src/dialyzer.xml | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/dialyzer/doc/src/dialyzer.xml b/lib/dialyzer/doc/src/dialyzer.xml index f5e8337eb1..443de7b0dd 100644 --- a/lib/dialyzer/doc/src/dialyzer.xml +++ b/lib/dialyzer/doc/src/dialyzer.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2006</year><year>2017</year> + <year>2006</year><year>2019</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -85,7 +85,7 @@ dialyzer --help</code> dialyzer [--add_to_plt] [--apps applications] [--build_plt] [--check_plt] [-Ddefine]* [-Dname] [--dump_callgraph file] [files_or_dirs] [--fullpath] [--get_warnings] [--gui] [--help] - [-I include_dir]* [--no_check_plt] [--no_native] + [-I include_dir]* [--no_check_plt] [--no_indentation] [--no_native] [--no_native_cache] [-o outfile] [--output_plt file] [-pa dir]* [--plt plt] [--plt_info] [--plts plt*] [--quiet] [-r dirs] [--raw] [--remove_from_plt] [--shell] [--src] [--statistics] @@ -181,6 +181,11 @@ dialyzer --apps inets ssl ./ebin ../other_lib/ebin/my_module.beam</code> <p>Skip the PLT check when running Dialyzer. This is useful when working with installed PLTs that never change.</p> </item> + <tag><c>--no_indentation</c></tag> + <item> + <p>Do not insert line breaks in types, contracts, and Erlang + Code when formatting warnings.</p> + </item> <tag><c>--no_native</c> (or <c>-nn</c>)</tag> <item> <p>Bypass the native code compilation of some key files that @@ -485,6 +490,23 @@ dialyzer --plts plt_1 ... plt_n -- files_to_analyze</code> </func> <func> + <name since="">format_warning(Msg, Options) -> string()</name> + <fsummary>Get the string version of a warning message.</fsummary> + <type> + <v>Msg = {Tag, Id, msg()}</v> + <d>See <c>run/1</c>.</d> + <v>Options = [{indent_opt, boolean()}]</v> + </type> + <desc> + <p>Get a string from warnings as returned by + <seealso marker="#run/1"><c>run/1</c></seealso>.</p> + <p>If <c>indent_opt</c> is set to <c>true</c> (default), + line breaks are inserted in types, contracts, and Erlang + code to improve readability.</p> + </desc> + </func> + + <func> <name since="">gui() -> ok | {error, Msg}</name> <name since="">gui(OptList) -> ok | {error, Msg}</name> <fsummary>Dialyzer GUI version.</fsummary> |