From 0839efda57d39469cc89c40b03814768f0d538e5 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 27 Sep 2015 10:24:16 -0500 Subject: fix dialyzer warnings --- src/rebar3.erl | 1 + src/rebar_app_info.erl | 6 +++--- src/rebar_dialyzer_format.erl | 9 +++------ src/rebar_prv_local_install.erl | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/rebar3.erl b/src/rebar3.erl index 9aad909..e55db71 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -45,6 +45,7 @@ %% For running with: %% erl +sbtu +A0 -noinput -mode minimal -boot start_clean -s rebar3 main -extra "$@" +-spec main() -> no_return(). main() -> List = init:get_plain_arguments(), main(List). diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index bb9f7a4..95b4624 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -83,7 +83,7 @@ dir :: file:name(), out_dir :: file:name(), resource_type :: pkg | src, - source :: string() | tuple() | undefined, + source :: string() | tuple() | checkout | undefined, is_lock=false :: boolean(), is_checkout=false :: boolean(), valid :: boolean()}). @@ -231,7 +231,7 @@ app_file_src(#app_info_t{app_file_src=undefined, dir=Dir, name=Name}) -> app_file_src(#app_info_t{app_file_src=AppFileSrc}) -> ec_cnv:to_list(AppFileSrc). --spec app_file_src(t(), file:filename_all()) -> t(). +-spec app_file_src(t(), file:filename_all() | undefined) -> t(). app_file_src(AppInfo=#app_info_t{}, undefined) -> AppInfo#app_info_t{app_file_src=undefined}; app_file_src(AppInfo=#app_info_t{}, AppFileSrc) -> @@ -369,7 +369,7 @@ resource_type(AppInfo=#app_info_t{}, Type) -> resource_type(#app_info_t{resource_type=ResourceType}) -> ResourceType. --spec source(t(), string() | tuple()) -> t(). +-spec source(t(), string() | tuple() | checkout) -> t(). source(AppInfo=#app_info_t{}, Source) -> AppInfo#app_info_t{source=Source}. diff --git a/src/rebar_dialyzer_format.erl b/src/rebar_dialyzer_format.erl index fbda8d0..0fd2b6e 100644 --- a/src/rebar_dialyzer_format.erl +++ b/src/rebar_dialyzer_format.erl @@ -31,12 +31,9 @@ fmt(Fmt, Args) -> format_warning({Tag, {File, Line, _MFA}, Msg}, FOpt) -> format_warning({Tag, {File, Line}, Msg}, FOpt); -format_warning({_Tag, {File, Line}, Msg}, FOpt) when is_list(File), - is_integer(Line) -> - F = case FOpt of - fullpath -> re:replace(File, "^.*/_build/", "_build/"); - basename -> filename:basename(File) - end, +format_warning({_Tag, {File, Line}, Msg}, fullpath) when is_list(File), + is_integer(Line) -> + F = re:replace(File, "^.*/_build/", "_build/"), String = lists:flatten(message_to_string(Msg)), lists:flatten(fmt("~s:~w~n~s", [F, Line, String])). diff --git a/src/rebar_prv_local_install.erl b/src/rebar_prv_local_install.erl index 172986d..65468a3 100644 --- a/src/rebar_prv_local_install.erl +++ b/src/rebar_prv_local_install.erl @@ -82,7 +82,7 @@ extract_escript(State, ScriptPath) -> {ok, #file_info{mode = _, uid = Uid, - gid = Gid}} = file:read_file_info(ScriptPath, [mode, uid, gid]), + gid = Gid}} = file:read_file_info(ScriptPath), ?INFO("Writing rebar3 run script ~s...", [BinFile]), file:write_file(BinFile, bin_contents(OutputDir)), -- cgit v1.1