Bläddra i källkod

slowly widdling away at dialyzer errors

pull/3/head
Tristan Sloughter 10 år sedan
förälder
incheckning
e1b1152b21
15 ändrade filer med 46 tillägg och 115 borttagningar
  1. +11
    -8
      Makefile
  2. +0
    -3
      dialyzer_reference
  3. +5
    -3
      src/rebar_app_discover.erl
  4. +4
    -5
      src/rebar_app_info.erl
  5. +1
    -50
      src/rebar_app_utils.erl
  6. +2
    -2
      src/rebar_config.erl
  7. +0
    -2
      src/rebar_core.erl
  8. +1
    -1
      src/rebar_prv_do.erl
  9. +5
    -5
      src/rebar_prv_escripter.erl
  10. +1
    -1
      src/rebar_prv_help.erl
  11. +6
    -26
      src/rebar_prv_new.erl
  12. +1
    -1
      src/rebar_prv_release.erl
  13. +3
    -3
      src/rebar_prv_tar.erl
  14. +2
    -2
      src/rebar_prv_update.erl
  15. +4
    -3
      src/rebar_state.erl

+ 11
- 8
Makefile Visa fil

@ -1,8 +1,10 @@
.PHONY: clean dialyzer_warnings xref_warnings deps test
.PHONY: clean xref_warnings deps test
REBAR=$(PWD)/rebar3
RETEST=$(PWD)/deps/retest/retest
DEPS_PLT=$(CURDIR)/.depsolver_plt
all:
./bootstrap/bootstrap
@ -11,23 +13,24 @@ clean:
@rm -f .rebarinfo
distclean: clean
@rm -f dialyzer_warnings
@rm -rf deps
debug:
@./bootstrap/bootstrap debug
check: debug xref dialyzer deps test
check: debug xref deps test
xref:
@./rebar3 xref
dialyzer: dialyzer_warnings
@diff -U0 dialyzer_reference dialyzer_warnings
$(DEPS_PLT):
@echo Building local erts plt at $(DEPS_PLT)
@echo
dialyzer --output_plt $(DEPS_PLT) --build_plt \
--apps erts kernel stdlib -r deps
dialyzer_warnings:
-@dialyzer -q -nn -n ebin -Wunmatched_returns -Werror_handling \
-Wrace_conditions > dialyzer_warnings
dialyzer: $(DEPS_PLT)
dialyzer --fullpath --plt $(DEPS_PLT) -Wno_opaque -Wrace_conditions -r ./ebin
binary: VSN = $(shell ./rebar3 -V)
binary: clean all

+ 0
- 3
dialyzer_reference Visa fil

@ -1,3 +0,0 @@
rebar_eunit.erl:471: Call to missing or unexported function eunit_test:function_wrapper/2
rebar_utils.erl:197: Call to missing or unexported function escript:foldl/3

+ 5
- 3
src/rebar_app_discover.erl Visa fil

@ -105,6 +105,7 @@ find_app(AppDir, Validate) ->
app_dir(AppFile) ->
filename:join(rebar_utils:droplast(filename:split(filename:dirname(AppFile)))).
-spec create_app_info(file:name(), file:name()) -> rebar_app_info:t() | error.
create_app_info(AppDir, AppFile) ->
case file:consult(AppFile) of
{ok, [{application, AppName, AppDetails}]} ->
@ -122,7 +123,9 @@ create_app_info(AppDir, AppFile) ->
AppState1 = rebar_state:set(AppState, base_dir, AbsCwd),
AppInfo1 = rebar_app_info:config(
rebar_app_info:app_details(AppInfo, AppDetails), AppState1),
rebar_app_info:dir(AppInfo1, AppDir)
rebar_app_info:dir(AppInfo1, AppDir);
_ ->
error
end.
-spec validate_application_info(rebar_app_info:t()) -> boolean().
@ -149,8 +152,7 @@ get_modules_list(AppFile, AppDetail) ->
{ok, ModulesList}
end.
-spec has_all_beams(file:name(), list()) ->
ok | {error, Reason::term()}.
-spec has_all_beams(file:name(), list()) -> boolean().
has_all_beams(EbinDir, [Module | ModuleList]) ->
BeamFile = filename:join([EbinDir,
ec_cnv:to_list(Module) ++ ".beam"]),

+ 4
- 5
src/rebar_app_info.erl Visa fil

@ -87,13 +87,12 @@ new(AppName, Vsn, Dir, Deps) ->
deps=Deps}}.
%% @doc discover a complete version of the app info with all fields set.
-spec discover(file:name()) ->
{ok, t()}.
-spec discover(file:name()) -> {ok, t()} | not_found.
discover(Dir) ->
case rebar_app_discover:find_app(Dir, all) of
{true, AppInfo} ->
{ok, AppInfo};
_ ->
false ->
not_found
end.
@ -157,7 +156,7 @@ app_details(AppInfo=#app_info_t{}, AppDetails) ->
original_vsn(#app_info_t{original_vsn=Vsn}) ->
Vsn.
-spec original_vsn(t(), string()) -> string().
-spec original_vsn(t(), string()) -> t().
original_vsn(AppInfo=#app_info_t{}, Vsn) ->
AppInfo#app_info_t{original_vsn=Vsn}.
@ -172,7 +171,7 @@ deps(AppInfo=#app_info_t{}, Deps) ->
dep_level(AppInfo=#app_info_t{}, Level) ->
AppInfo#app_info_t{dep_level=Level}.
dep_level(AppInfo=#app_info_t{dep_level=Level}) ->
dep_level(#app_info_t{dep_level=Level}) ->
Level.
-spec dir(t()) -> file:name().

+ 1
- 50
src/rebar_app_utils.erl Visa fil

@ -33,8 +33,7 @@
app_src_to_app/1,
app_name/2,
app_applications/2,
app_vsn/2,
is_skipped_app/2]).
app_vsn/2]).
-export([load_app_file/2]). % TEMPORARY
@ -124,30 +123,6 @@ app_vsn(Config, AppFile) ->
[AppFile, Reason])
end.
is_skipped_app(Config, AppFile) ->
{Config1, ThisApp} = app_name(Config, AppFile),
%% Check for apps global parameter; this is a comma-delimited list
%% of apps on which we want to run commands
Skipped =
case get_apps(Config) of
undefined ->
%% No apps parameter specified, check the skip_apps list..
case get_skip_apps(Config) of
undefined ->
%% No skip_apps list, run everything..
false;
SkipApps ->
TargetApps = [list_to_atom(A) ||
A <- string:tokens(SkipApps, ",")],
is_skipped(ThisApp, TargetApps)
end;
Apps ->
%% run only selected apps
TargetApps = [list_to_atom(A) || A <- string:tokens(Apps, ",")],
is_selected(ThisApp, TargetApps)
end,
{Config1, Skipped}.
%% ===================================================================
%% Internal functions
%% ===================================================================
@ -191,27 +166,3 @@ get_value(Key, AppInfo, AppFile) ->
Value ->
Value
end.
%% apps= for selecting apps
is_selected(ThisApp, TargetApps) ->
case lists:member(ThisApp, TargetApps) of
false ->
{true, ThisApp};
true ->
false
end.
%% skip_apps= for filtering apps
is_skipped(ThisApp, TargetApps) ->
case lists:member(ThisApp, TargetApps) of
false ->
false;
true ->
{true, ThisApp}
end.
get_apps(Config) ->
rebar_config:get_global(Config, apps, undefined).
get_skip_apps(Config) ->
rebar_config:get_global(Config, skip_apps, undefined).

+ 2
- 2
src/rebar_config.erl Visa fil

@ -35,11 +35,11 @@
%% Public API
%% ===================================================================
-spec consult(file:name()) -> {ok, any()}.
-spec consult(file:name()) -> [any()].
consult(Dir) ->
consult_file(filename:join(Dir, ?DEFAULT_CONFIG_FILE)).
-spec consult_file(file:name()) -> {ok, any()}.
-spec consult_file(file:name()) -> [any()].
consult_file(File) when is_binary(File) ->
consult_file(binary_to_list(File));
consult_file(File) ->

+ 0
- 2
src/rebar_core.erl Visa fil

@ -55,8 +55,6 @@ update_code_path(State) ->
%% Internal functions
%% ===================================================================
update_code_path_([]) ->
no_change;
update_code_path_(Paths) ->
LibPaths = expand_lib_dirs(Paths, rebar_utils:get_cwd(), []),
ok = code:add_pathsa(LibPaths),

+ 1
- 1
src/rebar_prv_do.erl Visa fil

@ -29,7 +29,7 @@ init(State) ->
opts = []}),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error().
-spec do(rebar_state:t()) -> {ok, rebar_state:t()}.
do(State) ->
Tasks = args_to_tasks(rebar_state:command_args(State)),
State1 = lists:foldl(fun(TaskArgs, StateAcc) ->

+ 5
- 5
src/rebar_prv_escripter.erl Visa fil

@ -61,7 +61,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error().
do(Config) ->
AppName = rebar_state:get_local(Config, escript_top_level_app, undefined),
AppName = rebar_state:get(Config, escript_top_level_app, undefined),
App = rebar_state:get_app(Config, AppName),
{ok, Config1} = escriptize(Config, rebar_app_info:app_file(App)),
{ok, Config1}.
@ -73,14 +73,14 @@ escriptize(Config0, AppFile) ->
AppNameStr = atom_to_list(AppName),
%% Get the output filename for the escript -- this may include dirs
Filename = rebar_state:get_local(Config, escript_name, AppName),
Filename = rebar_state:get(Config, escript_name, AppName),
ok = filelib:ensure_dir(Filename),
%% Look for a list of other applications (dependencies) to include
%% in the output file. We then use the .app files for each of these
%% to pull in all the .beam files.
InclBeams = get_app_beams(
rebar_state:get_local(Config, escript_incl_apps, []), []),
rebar_state:get(Config, escript_incl_apps, []), []),
%% Look for a list of extra files to include in the output file.
%% For internal rebar-private use only. Do not use outside rebar.
@ -130,7 +130,7 @@ clean(Config0, AppFile) ->
{Config, AppName} = rebar_app_utils:app_name(Config0, AppFile),
%% Get the output filename for the escript -- this may include dirs
Filename = rebar_state:get_local(Config, escript_name, AppName),
Filename = rebar_state:get(Config, escript_name, AppName),
rebar_file_utils:delete_each([Filename]),
{ok, Config}.
@ -176,7 +176,7 @@ get_app_beams([App | Rest], Acc) ->
end.
get_extra(Config) ->
Extra = rebar_state:get_local(Config, escript_incl_extra, []),
Extra = rebar_state:get(Config, escript_incl_extra, []),
lists:foldl(fun({Wildcard, Dir}, Files) ->
load_files(Wildcard, Dir) ++ Files
end, [], Extra).

+ 1
- 1
src/rebar_prv_help.erl Visa fil

@ -29,7 +29,7 @@ init(State) ->
opts = []}),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error().
-spec do(rebar_state:t()) -> {ok, rebar_state:t()}.
do(State) ->
help(State),
{ok, State}.

+ 6
- 26
src/rebar_prv_new.erl Visa fil

@ -22,7 +22,7 @@ init(State) ->
deps = ?DEPS,
example = "rebar new <template>",
short_desc = "Create new project from templates.",
desc = info(create),
desc = info(),
opts = []}),
{ok, State1}.
@ -45,29 +45,9 @@ do(State) ->
%% Internal functions
%% ===================================================================
info(create) ->
info() ->
io_lib:format(
"Create skel based on template and vars.~n"
"~n"
"Valid command line options:~n"
" template= [var=foo,...]~n", []);
info(create_app) ->
io_lib:format(
"Create simple app skel.~n"
"~n"
"Valid command line options:~n"
" [appid=myapp]~n", []);
info(create_lib) ->
io_lib:format(
"Create simple lib skel.~n"
"~n"
"Valid command line options:~n"
" [libid=mylib]~n", []);
info(create_node) ->
io_lib:format(
"Create simple node skel.~n"
"~n"
"Valid command line options:~n"
" [nodeid=mynode]~n", []);
info(list_templates) ->
io_lib:format("List available templates.~n", []).
"Create rebar project based on template and vars.~n"
"~n"
"Valid command line options:~n"
" template= [var=foo,...]~n", []).

+ 1
- 1
src/rebar_prv_release.erl Visa fil

@ -29,7 +29,7 @@ init(State) ->
opts = []}),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error().
-spec do(rebar_state:t()) -> {ok, rebar_state:t()}.
do(Config) ->
relx:main("release"),
{ok, Config}.

+ 3
- 3
src/rebar_prv_tar.erl Visa fil

@ -29,7 +29,7 @@ init(State) ->
opts = []}),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error().
do(Config) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()}.
do(State) ->
relx:main("release tar"),
{ok, Config}.
{ok, State}.

+ 2
- 2
src/rebar_prv_update.erl Visa fil

@ -29,13 +29,13 @@ init(State) ->
opts = []}),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | rebar:error().
-spec do(rebar_state:t()) -> {ok, rebar_state:t()}.
do(State) ->
case rebar_state:command_args(State) of
[Name] ->
?ERROR("NOT IMPLEMENTED: Updating ~s~n", [Name]),
AllDeps = rebar_state:get(State, all_deps, []),
{ok, App} = rebar_app_utils:find(list_to_binary(Name), AllDeps),
{ok, _App} = rebar_app_utils:find(list_to_binary(Name), AllDeps),
rebar_prv_install_deps:handle_deps(State, [list_to_atom(Name)], true),
{ok, State};
[] ->

+ 4
- 3
src/rebar_state.erl Visa fil

@ -37,7 +37,7 @@
command_args = [] :: list(),
src_deps = [] :: [rebar_app_info:t()],
src_apps = [] :: dict:dict(),
src_apps = [] :: [rebar_app_info:t()],
binary_deps = [],
project_apps = [] :: [rebar_app_info:t()],
@ -68,7 +68,7 @@ new(ParentState=#state_t{}, Config) ->
new(ParentState, Config, Dir) ->
_Opts = ParentState#state_t.opts,
LocalOpts = case rebar_config:consult_file(?LOCK_FILE) of
{ok, [D]} ->
[D] ->
[{locks, D} | Config];
_ ->
Config
@ -144,7 +144,7 @@ src_deps(State=#state_t{src_deps=SrcDeps}, SrcDep) ->
src_apps(#state_t{src_apps=SrcApps}) ->
SrcApps.
src_apps(State=#state_t{src_apps=SrcApps}, NewSrcApps) when is_list(NewSrcApps) ->
src_apps(State=#state_t{src_apps=_SrcApps}, NewSrcApps) when is_list(NewSrcApps) ->
State#state_t{src_apps=NewSrcApps};
src_apps(State=#state_t{src_apps=SrcApps}, NewSrcApp) ->
State#state_t{src_apps=[NewSrcApp | SrcApps]}.
@ -163,6 +163,7 @@ providers(#state_t{providers=Providers}) ->
providers(State, NewProviders) ->
State#state_t{providers=NewProviders}.
-spec add_provider(t(), rebar_provider:t()) -> t().
add_provider(State=#state_t{providers=Providers}, Provider) ->
State#state_t{providers=[Provider | Providers]}.

Laddar…
Avbryt
Spara