diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_eunit.erl | 2 | ||||
-rw-r--r-- | src/rebar_xref.erl | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl index dd1546d..1cfd14d 100644 --- a/src/rebar_eunit.erl +++ b/src/rebar_eunit.erl @@ -74,7 +74,7 @@ eunit(Config, _File) -> %% with that scan and causes any cover compilation info to be lost. %% Filter out "*_tests" modules so eunit won't doubly run them and %% so cover only calculates coverage on production code. - BeamFiles = [N || N <- rebar_utils:beams(?EUNIT_DIR), + BeamFiles = [N || N <- rebar_utils:beams(?EUNIT_DIR), string:str(N, "_tests.beam") =:= 0], Modules = [rebar_utils:beam_to_mod(?EUNIT_DIR, N) || N <- BeamFiles], diff --git a/src/rebar_xref.erl b/src/rebar_xref.erl index b5e6d8a..c93995b 100644 --- a/src/rebar_xref.erl +++ b/src/rebar_xref.erl @@ -48,6 +48,10 @@ xref(Config, _) -> {verbose, rebar_config:is_verbose()}]), {ok, _} = xref:add_directory(xref, "ebin"), + %% Save the code path prior to doing anything + OrigPath = code:get_path(), + 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, undefined_function_calls]), @@ -68,6 +72,9 @@ xref(Config, _) -> ok end, + %% Restore the original code path + code:set_path(OrigPath), + ok. foobar() -> @@ -87,7 +94,6 @@ check_exports_not_used(_Config) -> 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", @@ -98,7 +104,7 @@ check_undefined_function_calls(_Config) -> code_path() -> [P || P <- code:get_path(), - filelib:is_dir(P)]. + filelib:is_dir(P)] ++ [filename:join(rebar_utils:get_cwd(), "ebin")]. %% %% Ignore behaviour functions, and explicitly marked functions @@ -182,3 +188,4 @@ find_mfa_source({M, F, A}) -> Source = abstract_code_source_file(Code), Line = abstract_code_function_line(Code, F, A), {Source, Line}. + |