You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/09/23 14:29:09 UTC

[15/50] rebar commit: updated refs/heads/import to 5dea85d

dialyzer: consistent warning formatting


Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/0223f1e4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/0223f1e4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/0223f1e4

Branch: refs/heads/import
Commit: 0223f1e4342e906c90a1d8724c1fa917f69e1fca
Parents: 850a8a3
Author: James Fish <ja...@fishcakez.com>
Authored: Sun Mar 29 18:49:09 2015 +0100
Committer: Tuncer Ayaz <tu...@gmail.com>
Committed: Fri May 22 09:53:09 2015 +0200

----------------------------------------------------------------------
 src/rebar_dialyzer.erl | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/0223f1e4/src/rebar_dialyzer.erl
----------------------------------------------------------------------
diff --git a/src/rebar_dialyzer.erl b/src/rebar_dialyzer.erl
index 5f0cb1e..1685b99 100644
--- a/src/rebar_dialyzer.erl
+++ b/src/rebar_dialyzer.erl
@@ -63,7 +63,7 @@ dialyze(Config, AppFile) ->
         [] ->
             {ok, NewConfig};
         Ws ->
-            print_warnings(Ws),
+            print_warnings(Ws, fullpath),
             ?FAIL
     end.
 
@@ -83,7 +83,7 @@ dialyze(Config, AppFile) ->
             %% As plt_build may raise warnings but still successfully
             %% create the PLT, we cannot interpret this as failure,
             %% and therefore all we can do is report warnings.
-            print_warnings(Ws)
+            print_warnings(Ws, basename)
     end.
 
 'check-plt'(Config, AppFile) ->
@@ -104,7 +104,7 @@ dialyze(Config, AppFile) ->
         [] ->
             {ok, NewConfig};
         Ws ->
-            print_warnings(Ws),
+            print_warnings(Ws, basename),
             ?FAIL
     end.
 
@@ -195,15 +195,24 @@ run(Opts) ->
 warnings(Config) ->
     rebar_config:get_local(Config, dialyzer_warnings, []).
 
-print_warnings(Ws) ->
+print_warnings(Ws, Option) ->
     lists:foreach(
       fun(W) ->
-              ?CONSOLE("~s~n", [format_warning(W)])
+              ?CONSOLE("~s~n", [format_warning(W, Option)])
       end,
       Ws).
 
-format_warning(W) ->
-    dialyzer:format_warning(W, fullpath).
+format_warning(W, Option) ->
+    case dialyzer:format_warning(W, Option) of
+        ":0: " ++ Unknown ->
+            strip_newline(Unknown);
+        Warning ->
+            strip_newline(Warning)
+    end.
+
+%% Warning may or may not have trailing \n.
+strip_newline(Warning) ->
+    string:strip(Warning, right, $\n).
 
 app_dirs(Config, AppFile) ->
     {NewConfig, AppFileApps} = app_file_apps(Config, AppFile),