Skip to content

Commit

Permalink
Add elvis target
Browse files Browse the repository at this point in the history
  • Loading branch information
lpgauth committed Jan 27, 2016
1 parent e25e43a commit 761f025
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CACHEGRIND=qcachegrind
REBAR=./rebar3
ELVIS=./bin/elvis
REBAR=./bin/rebar3

all: compile

Expand All @@ -19,6 +20,10 @@ edoc:
@echo "Running rebar3 edoc..."
@$(REBAR) edoc

elvis:
@echo "Running elvis rock..."
@$(ELVIS) rock

eunit:
@echo "Running rebar3 eunit..."
@$(REBAR) do eunit -cv, cover -v
Expand All @@ -33,10 +38,10 @@ profile:
@_build/test/lib/fprofx/erlgrindx -p fprofx.analysis
@$(CACHEGRIND) fprofx.cgrind

test: compile dialyzer eunit xref
test: compile dialyzer elvis eunit xref

xref:
@echo "Running rebar3 xref..."
@$(REBAR) xref

.PHONY: clean compile dialyzer edoc eunit profile xref
.PHONY: clean compile dialyzer edoc elvis eunit profile xref
Binary file added bin/elvis
Binary file not shown.
File renamed without changes.
35 changes: 35 additions & 0 deletions elvis.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[{elvis, [
{config, [
#{dirs => ["src", "test"],
filter => "*.erl",
rules => [
{elvis_style, dont_repeat_yourself, #{min_complexity => 10}},
{elvis_style, god_modules, #{limit => 25}},
{elvis_style, invalid_dynamic_call, #{ignore => []}},
{elvis_style, line_length, #{limit => 80, skip_comments => false}},
{elvis_style, macro_module_names},
{elvis_style, macro_names},
{elvis_style, module_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$", ignore => []}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, no_behavior_info},
{elvis_style, no_if_expression},
{elvis_style, no_spec_with_records},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}},
{elvis_style, state_record_and_type},
{elvis_style, used_ignored_variable}
]},
#{dirs => ["."],
filter => "rebar.config",
rules => [
{elvis_project, no_deps_master_rebar, #{ignore => []}},
{elvis_project, protocol_for_deps_rebar, #{ignore => []}}
]},
#{dirs => ["."],
filter => "elvis.config",
rules => [
{elvis_project, old_configuration_format}
]}
]}
]}].
6 changes: 4 additions & 2 deletions test/statsderl_profile.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ fprofx() ->
lists:foreach(fun code:load_abs/1, Rootnames),

application:start(statsderl),
[statsderl:increment(["test", <<".test">>], 1, 0.25) || _ <- lists:seq(1, ?N)],
[statsderl:increment(["test", <<".test">>], 1, 0.25) ||
_ <- lists:seq(1, ?N)],

fprofx:start(),
{ok, Tracer} = fprofx:profile(start),
fprofx:trace([start, {procs, new}, {tracer, Tracer}]),

Self = self(),
[spawn(fun () ->
[statsderl:increment(["test", <<".test">>], 1, 0.25) || _ <- lists:seq(1, ?N)],
[statsderl:increment(["test", <<".test">>], 1, 0.25) ||
_ <- lists:seq(1, ?N)],
Self ! exit
end) || _ <- lists:seq(1, ?P)],
wait(),
Expand Down
4 changes: 3 additions & 1 deletion test/statsderl_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ sampling_rate_subtest(Socket) ->
meck:expect(statsderl_utils, random, fun (?MAX_UNSIGNED_INT_32) -> 0 end),
statsderl:counter("test", 1, 0.1234),
assert_packet(Socket, <<"test:1|c|@0.123">>),
meck:expect(statsderl_utils, random, fun (?MAX_UNSIGNED_INT_32) -> ?MAX_UNSIGNED_INT_32 end),
meck:expect(statsderl_utils, random, fun (?MAX_UNSIGNED_INT_32) ->
?MAX_UNSIGNED_INT_32
end),
statsderl:counter("test", 1, 0.1234),
meck:unload(statsderl_utils).

Expand Down

0 comments on commit 761f025

Please sign in to comment.