From a0bbb69254ef68899577572abae874c068f397e7 Mon Sep 17 00:00:00 2001 From: Pablo Costas Date: Sun, 15 Mar 2020 20:48:50 +0100 Subject: [PATCH] xref improvements: now outputs relative file paths Closes #2108. Changes the path to be printed to a relative path to the current directory. Also removes the `exports_not_used` warning from the default ones, as Tristan suggested. --- src/rebar_prv_xref.erl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rebar_prv_xref.erl b/src/rebar_prv_xref.erl index 3c987b47..359288f3 100644 --- a/src/rebar_prv_xref.erl +++ b/src/rebar_prv_xref.erl @@ -104,8 +104,7 @@ prepare(State) -> %% Get list of xref checks we want to run ConfXrefChecks = rebar_state:get(State, xref_checks, - [exports_not_used, - undefined_function_calls]), + [undefined_function_calls]), XrefChecks = sets:to_list(sets:intersection( sets:from_list(?SUPPORTED_XREFS), @@ -215,11 +214,15 @@ display_xref_result_fun(Type) -> {Source, SMFA, TMFA} = case XrefResult of {MFASource, MFATarget} -> - {format_mfa_source(MFASource), + Cwd = rebar_dir:get_cwd(), + FormattedSource = format_mfa_source(MFASource), + {rebar_dir:make_relative_path(FormattedSource, Cwd), format_mfa(MFASource), format_mfa(MFATarget)}; MFATarget -> - {format_mfa_source(MFATarget), + Cwd = rebar_dir:get_cwd(), + FormattedTarget = format_mfa_source(MFATarget), + {rebar_dir:make_relative_path(FormattedTarget, Cwd), format_mfa(MFATarget), undefined} end,