elvis_core
elvis_core copied to clipboard
New rule: consistent deps applications
Name
consistent_deps_applications
Brief Description
It's common to have .app.src
updated with the dep names from rebar.config
. This rule would look at rebar.config
's deps
, and compare them with the first found .app.src
file in src/
.
Reasoning
One less thing to remember when you're adding dependencies to your projects.
Refactoring Proposal
Make sure their list, in .app.src
, is the same as deps
. We could output the comma-separated list that could be simply copy-and-pasted, then formatted, as well as present an option to exclude applications when these aren't supposed to be in the .app.src
file.
It probably shouldn't be "the same list", since some applications are libraries and therefore there is no need to start them as part of the main application startup procedure, but the .app.src list should 100% be "a sublist" of deps.
Oh, and we need to be careful with umbrella repos, too.
On the other hand, if there is an app on .app.src that's not on deps (i.e., the list is not a sublist), the main app will fail on initialization (i.e. ensure_all_started(the_main_app)
), or (if the app is never initialized - again, library apps) it will fail on Dialyzer/Xref checks when they find unknown function calls. That is, unless the app is never used, in which case this should be a more suitable rule for Hank than Elvis.