summaryrefslogtreecommitdiff
path: root/src/rebar_xref.erl
diff options
context:
space:
mode:
authorKostis Sagonas <kostis@cs.ntua.gr>2010-10-10 14:11:13 -0600
committerKostis Sagonas <kostis@cs.ntua.gr>2010-10-10 14:11:13 -0600
commite024778599c71559f97003014ae8457a19e01256 (patch)
treeb041ad5aa571c862e0669e83cdf451606db08e3c /src/rebar_xref.erl
parent93f77b50fc89690848a902428b38bcf5e21bfd7e (diff)
Dialyzer related cleanups
Diffstat (limited to 'src/rebar_xref.erl')
-rw-r--r--src/rebar_xref.erl24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/rebar_xref.erl b/src/rebar_xref.erl
index 1f67a37..19700d3 100644
--- a/src/rebar_xref.erl
+++ b/src/rebar_xref.erl
@@ -50,7 +50,7 @@ xref(Config, _) ->
%% Save the code path prior to doing anything
OrigPath = code:get_path(),
- code:add_path(filename:join(rebar_utils:get_cwd(), "ebin")),
+ true = code:add_path(filename:join(rebar_utils:get_cwd(), "ebin")),
%% Get list of xref checks we want to run
XrefChecks = rebar_config:get(Config, xref_checks, [exports_not_used,
@@ -73,7 +73,7 @@ xref(Config, _) ->
end,
%% Restore the original code path
- code:set_path(OrigPath),
+ true = code:set_path(OrigPath),
ok.
@@ -93,9 +93,10 @@ check_undefined_function_calls(_Config) ->
{ok, UndefinedCalls0} = xref:analyze(xref, undefined_function_calls),
UndefinedCalls = [{find_mfa_source(Caller), format_fa(Caller), format_mfa(Target)} ||
{Caller, Target} <- UndefinedCalls0],
- [?CONSOLE("~s:~w: Warning ~s calls undefined function ~s\n",
- [Source, Line, FunStr, Target]) ||
- {{Source, Line}, FunStr, Target} <- UndefinedCalls],
+ lists:foreach(fun({{Source, Line}, FunStr, Target}) ->
+ ?CONSOLE("~s:~w: Warning ~s calls undefined function ~s\n",
+ [Source, Line, FunStr, Target])
+ end, UndefinedCalls),
ok.
@@ -114,19 +115,18 @@ filter_away_ignored(UnusedExports) ->
%% any functions marked to ignore. We then use this list to mask any functions
%% marked as unused exports by xref
F = fun(Mod) ->
- Attrs = ks(attributes, Mod:module_info()),
- Ignore = ks(ignore_xref, Attrs),
- Callbacks = [B:behaviour_info(callbacks) || B <- ks(behaviour, Attrs)],
+ Attrs = kf(attributes, Mod:module_info()),
+ Ignore = kf(ignore_xref, Attrs),
+ Callbacks = [B:behaviour_info(callbacks) || B <- kf(behaviour, Attrs)],
[{Mod, F, A} || {F, A} <- Ignore ++ lists:flatten(Callbacks)]
end,
AttrIgnore = lists:flatten(lists:map(F, lists:usort([M || {M, _, _} <- UnusedExports]))),
[X || X <- UnusedExports, not(lists:member(X, AttrIgnore))].
-
-ks(Key, List) ->
- case lists:keysearch(Key, 1, List) of
- {value, {Key, Value}} ->
+kf(Key, List) ->
+ case lists:keyfind(Key, 1, List) of
+ {Key, Value} ->
Value;
false ->
[]