Skip to content

Commit

Permalink
[inaka/elvis#406] dialyzer warnings fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ferigis committed Feb 9, 2017
1 parent a083332 commit 2d20d84
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/elvis_project.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
%% Rules
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-type protocol_for_deps_erlang_mk_config() :: #{ignore => [module()]}.
-type protocol_for_deps_erlang_mk_config() :: #{ignore => [module()],
regex => string()}.

%% Deprecated
-spec git_for_deps_erlang_mk(elvis_config:config(),
Expand All @@ -55,7 +56,8 @@ protocol_for_deps_erlang_mk(_Config, Target, RuleConfig) ->
erlang_mk_dep_to_result(Line, ?DEP_NO_GIT, {IgnoreDeps, Regex})
end, BadDeps).

-type protocol_for_deps_rebar_config() :: #{ignore => [module()]}.
-type protocol_for_deps_rebar_config() :: #{ignore => [module()],
regex => string()}.

-spec git_for_deps_rebar(elvis_config:config(),
elvis_file:file(),
Expand Down
16 changes: 12 additions & 4 deletions src/elvis_style.erl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@
-type empty_rule_config() :: #{}.

-type max_function_length_config() :: #{ignore_functions => [function_spec()],
max_length => non_neg_integer()}.
max_length => non_neg_integer(),
count_comments => boolean(),
count_whitespace => boolean()}.

-type max_module_length_config() :: #{count_comments => boolean(),
count_whitespace => boolean(),
Expand Down Expand Up @@ -262,7 +264,8 @@ operator_spaces(Config, Target, RuleConfig) ->
Rules
).

-type nesting_level_config() :: #{level => integer()}.
-type nesting_level_config() :: #{level => integer(),
ignore => [atom()]}.

-spec nesting_level(elvis_config:config(),
elvis_file:file(),
Expand All @@ -282,7 +285,8 @@ nesting_level(Config, Target, RuleConfig) ->
[]
end.

-type god_modules_config() :: #{limit => integer()}.
-type god_modules_config() :: #{limit => integer(),
ignore => [atom()]}.

-spec god_modules(elvis_config:config(),
elvis_file:file(),
Expand Down Expand Up @@ -456,9 +460,13 @@ no_spec_with_records(Config, Target, _RuleConfig) ->
lists:map(ResultFun, SpecNodes)
end.

-type dont_repeat_yourself_config() :: #{min_complexity => non_neg_integer(),
ignore => [module()]
}.

-spec dont_repeat_yourself(elvis_config:config(),
elvis_file:file(),
empty_rule_config()) ->
dont_repeat_yourself_config()) ->
[elvis_result:item()].
dont_repeat_yourself(Config, Target, RuleConfig) ->
MinComplexity = maps:get(min_complexity, RuleConfig, 5),
Expand Down
6 changes: 3 additions & 3 deletions test/examples/fail_macro_module_names.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build_binary/0
]).

-define(FUNCTION_NAME, function_name).
-define(FUN_NAME, function_name).
-define(BINARY, "bla").
-define(BINARY_SIZE, 3).
-define(function_name, function_name).
Expand All @@ -23,8 +23,8 @@ module_name() ->
?module_name:?function_name().

function_name() ->
module:?FUNCTION_NAME(params),
module:?FUNCTION_NAME (params),
module:?FUN_NAME(params),
module:?FUN_NAME (params),
lists:?MODULE().

build_binary() ->
Expand Down
2 changes: 1 addition & 1 deletion test/style_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ verify_nesting_level(_Config) ->
#{line_num := 78},
#{line_num := 120},
#{line_num := 166}
] = elvis_style:nesting_level(ElvisConfig, File, #{limit => 3}),
] = elvis_style:nesting_level(ElvisConfig, File, #{level => 3}),
[] = elvis_style:nesting_level( ElvisConfig
, File
, #{ignore => [fail_nesting_level]}).
Expand Down

0 comments on commit 2d20d84

Please sign in to comment.