Skip to content

Commit

Permalink
Add elvis_rock to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-kivra committed Oct 28, 2019
1 parent f079d47 commit 8f58b8c
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ priv
*.plt
ebin
_build
.elvis
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ELVIS_IN_PATH := $(shell elvis --version 2> /dev/null)
ELVIS_LOCAL := $(shell .elvis/_build/default/bin/elvis --version 2> /dev/null)

all: compile

compile:
Expand All @@ -6,6 +9,12 @@ compile:
clean:
rebar3 clean

eunit:
rebar3 eunit

ct:
rebar3 ct -v

xref:
rebar3 xref

Expand All @@ -20,3 +29,30 @@ unlock:

lock:
rebar3 lock

elvis:
ifdef ELVIS_IN_PATH
elvis git-branch origin/HEAD -V
else ifdef ELVIS_LOCAL
.elvis/_build/default/bin/elvis git-branch origin/HEAD -V
else
$(MAKE) compile_elvis
.elvis/_build/default/bin/elvis git-branch origin/HEAD -V
endif

elvis_rock:
ifdef ELVIS_IN_PATH
elvis rock
else ifdef ELVIS_LOCAL
.elvis/_build/default/bin/elvis rock
else
$(MAKE) compile_elvis
.elvis/_build/default/bin/elvis rock
endif

compile_elvis:
git clone https://github.com/inaka/elvis.git .elvis && \
cd .elvis && \
rebar3 compile && \
rebar3 escriptize && \
cd ..
81 changes: 81 additions & 0 deletions elvis.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
%% -*- erlang -*-
[ {elvis,
[ {config,
[ #{dirs => [ "src/*"
, "src"
],
filter => "*.erl",
ignore => [],
rules => [ {elvis_style, line_length,
#{ limit => 80,
skip_comments => false
}}
, {elvis_style, no_tabs}
, {elvis_style, no_trailing_whitespace}
, {elvis_style, macro_module_names}
, {elvis_style, nesting_level,
#{ level => 3,
ignore => [
]
}}
, {elvis_style, god_modules,
#{ limit => 25,
ignore => [
]
}}
, {elvis_style, no_nested_try_catch,
#{ignore => [
]
}}
, {elvis_style, invalid_dynamic_call,
#{ignore => [
]
}}
, {elvis_style, used_ignored_variable}
, {elvis_style, no_behavior_info}
, {elvis_style, module_naming_convention,
#{ ignore => [],
regex => "^([a-z][a-z0-9]*_?)([a-z0-9]*_?)*$"
}}
, {elvis_style, function_naming_convention,
#{ regex => "^([a-z][a-z0-9]*_?)([a-z0-9]*_?)*$"
}}
, {elvis_style, variable_naming_convention,
#{ regex => "^_?([A-Z][0-9a-zA-Z_]*)$"
}}
, {elvis_style, state_record_and_type}
, {elvis_style, no_spec_with_records}
, {elvis_style, dont_repeat_yourself,
#{ min_complexity => 25,
ignore => [
]
}}
]
},
#{dirs => [ "test"
],
filter => "*.erl",
rules => [ {elvis_style, line_length,
#{ limit => 80,
skip_comments => false
}}
, {elvis_style, no_tabs}
, {elvis_style, no_trailing_whitespace}
, {elvis_style, macro_module_names}
, {elvis_style, no_debug_call,
#{ignore => [
]
}}
]
}
]
}
]
}
].

%%%_* Emacs ====================================================================
%%% Local Variables:
%%% allout-layout: t
%%% erlang-indent-level: 2
%%% End:

0 comments on commit 8f58b8c

Please sign in to comment.