From 5c89f25d1083aebd366c3dd9841e9e0616c4b617 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Sun, 2 Jun 2019 13:52:47 -0400 Subject: Only lint app files when compiling This allows to reduce the number of noise to only checking deps' app files when they're built, rather than on every run. Since main apps and checkouts are still compiled every time, the linting takes place there and then with a higher frequency. --- src/rebar_app_utils.erl | 7 ++++++- src/rebar_prv_compile.erl | 1 + test/rebar_compile_SUITE.erl | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl index 91c095c..626f6aa 100644 --- a/src/rebar_app_utils.erl +++ b/src/rebar_app_utils.erl @@ -37,6 +37,7 @@ parse_dep/6, expand_deps_sources/2, dep_to_app/7, + lint_app_info/1, format_error/1]). -include("rebar.hrl"). @@ -101,7 +102,6 @@ validate_application_info(AppInfo, AppDetail) -> undefined -> false; AppFile -> - lint_detail(AppDetail, AppFile), case proplists:get_value(modules, AppDetail) of undefined -> ?PRV_ERROR({module_list, AppFile}); @@ -110,6 +110,11 @@ validate_application_info(AppInfo, AppDetail) -> end end. +lint_app_info(AppInfo) -> + AppDetails = rebar_app_info:app_details(AppInfo), + AppFile = rebar_app_info:app_file(AppInfo), + lint_detail(AppDetails, AppFile). + -spec lint_detail(list(), file:filename_all()) -> ok. lint_detail(AppDetail, AppFile) -> lint_description(AppDetail, AppFile), diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index cf2bcf2..2919c40 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -247,6 +247,7 @@ has_all_artifacts(AppInfo1) -> {false, File} -> throw(?PRV_ERROR({missing_artifact, File})); true -> + rebar_app_utils:lint_app_info(AppInfo1), true end. diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl index 8389ebc..3052367 100644 --- a/test/rebar_compile_SUITE.erl +++ b/test/rebar_compile_SUITE.erl @@ -41,7 +41,6 @@ all() -> dont_recompile_when_erl_compiler_options_env_does_not_change, recompile_when_erl_compiler_options_env_changes, rebar_config_os_var, - app_file_linting]. groups() -> -- cgit v1.1