Skip to content

Commit ab6ce22

Browse files
authored
Merge pull request #23 from rabbitmq/dialyze-configurable-ignore-warnings
No longer ignore dialyzer warnings in dialyze/dialyze_test
2 parents 298c012 + 47f6300 commit ab6ce22

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

private/dialyze.bzl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fi
5353
5454
set -x
5555
{erlang_home}/bin/dialyzer {apps_args} {plt_args}\\
56-
-c {dirs} {opts} || test $? -eq 2
56+
{dirs} {opts}{check_warnings}
5757
""".format(
5858
begins_with_fun = BEGINS_WITH_FUN,
5959
query_erlang_version = QUERY_ERL_VERSION,
@@ -64,6 +64,7 @@ set -x
6464
name = ctx.label.name,
6565
dirs = " ".join(dirs),
6666
opts = " ".join(ctx.attr.dialyzer_opts),
67+
check_warnings = " || test $? -eq 2" if not ctx.attr.warnings_as_errors else "",
6768
)
6869
else:
6970
output = ctx.actions.declare_file(ctx.label.name + ".bat")
@@ -72,9 +73,9 @@ echo Erlang Version: {erlang_version}
7273
7374
echo on
7475
"{erlang_home}\\bin\\dialyzer" {apps_args} {plt_args} ^
75-
-c {dirs} {opts}
76+
{dirs} {opts}
7677
if %ERRORLEVEL% EQU 0 EXIT /B 0
77-
if %ERRORLEVEL% EQU 2 EXIT /B 0
78+
{check_warnings}
7879
EXIT /B 1
7980
""".format(
8081
erlang_home = windows_path(ctx.attr._erlang_home[ErlangHomeProvider].path),
@@ -84,6 +85,7 @@ EXIT /B 1
8485
name = ctx.label.name,
8586
dirs = " ".join(dirs),
8687
opts = " ".join(ctx.attr.dialyzer_opts),
88+
check_warnings = "if %ERRORLEVEL% EQU 2 EXIT /B 0" if not ctx.attr.warnings_as_errors else "",
8789
)
8890

8991
ctx.actions.write(
@@ -123,6 +125,7 @@ dialyze_test = rule(
123125
"-Wunmatched_returns",
124126
],
125127
),
128+
"warnings_as_errors": attr.bool(default = True),
126129
},
127130
test = True,
128131
)

0 commit comments

Comments
 (0)