I'm adding Elvis check style to Erlang project built with rebar3.
Initially I've found rebar3_lint plugin for this. But then it appeared to use some old version of Elvis and fails not very graciously on errors.
Then after some play I attached elvis directly as a test dependency and then calling it with pre_hook and erlang code line:
{profiles, [
{test, [
{deps, [
{elvis_core,
{git, "https://github.com/inaka/elvis_core",
{branch, "master"}}}
]},
{pre_hooks, [{compile,
"erl -pa _build/test/lib/*/ebin -noshell -eval 'init:stop(case elvis_core:rock() of ok -> 0; _ -> 1 end)'"}]}
]},
]}
This works nicely, though looks awkward.
So is there any more "proper" way? Thanks in advance!
I would totally recommend using katana-test (you can find it on hex , as well). Using mixer, you can integrate a meta testing suite in your test suites easily and get elvis, xref and dialyzer checks ready for you. You can find how to do so in the README .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.