Skip to content

Commit

Permalink
Simplify and sort rules for rulesets
Browse files Browse the repository at this point in the history
We simplify via list comprehensions
We sort for readability

Note: this brings no relevant code changes
  • Loading branch information
kivra-pauoli committed Jan 16, 2024
1 parent dfaa84e commit 7967ffe
Showing 1 changed file with 87 additions and 87 deletions.
174 changes: 87 additions & 87 deletions src/elvis_rulesets.erl
Original file line number Diff line number Diff line change
Expand Up @@ -13,105 +13,105 @@ set_rulesets(RuleSets) ->
-spec rules(Group :: atom()) -> [elvis_core:rule()].
rules(hrl_files) ->
lists:map(fun({Mod, Rule}) -> {Mod, Rule, apply(Mod, default, [Rule])} end,
[{elvis_text_style, line_length},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, no_block_expressions},
{elvis_style, operator_spaces},
{elvis_style, no_space_after_pound},
{elvis_style, no_space},
{elvis_style, nesting_level},
{elvis_style, no_if_expression},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{elvis_style, no_debug_call},
{elvis_style, variable_naming_convention},
{elvis_style, consistent_variable_casing},
{elvis_style, no_nested_try_catch},
{elvis_style, no_successive_maps},
{elvis_style, atom_naming_convention},
{elvis_style, no_throw},
{elvis_style, no_dollar_space},
{elvis_style, no_author},
{elvis_style, no_import},
{elvis_style, no_catch_expressions},
{elvis_style, no_single_clause_case},
{elvis_style, no_match_in_condition},
{elvis_style, numeric_format},
{elvis_style, no_specs},
{elvis_style, no_types}]);
[{elvis_text_style, Rule} || Rule <- [line_length, no_tabs, no_trailing_whitespace]]
++ [{elvis_style, Rule}
|| Rule
<- [atom_naming_convention,
consistent_variable_casing,
macro_module_names,
macro_names,
nesting_level,
no_author,
no_behavior_info,
no_block_expressions,
no_catch_expressions,
no_debug_call,
no_dollar_space,
no_if_expression,
no_import,
no_match_in_condition,
no_nested_try_catch,
no_single_clause_case,
no_space,
no_space_after_pound,
no_specs,
no_successive_maps,
no_throw,
no_types,
numeric_format,
operator_spaces,
used_ignored_variable,
variable_naming_convention]]);
rules(erl_files) ->
lists:map(fun({Mod, Rule}) -> {Mod, Rule, apply(Mod, default, [Rule])} end,
[{elvis_text_style, line_length},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, no_block_expressions},
{elvis_style, operator_spaces},
{elvis_style, no_space_after_pound},
{elvis_style, no_space},
{elvis_style, nesting_level},
{elvis_style, god_modules},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{elvis_style, module_naming_convention},
{elvis_style, function_naming_convention},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself},
{elvis_style, no_debug_call},
{elvis_style, variable_naming_convention},
{elvis_style, consistent_variable_casing},
{elvis_style, no_nested_try_catch},
{elvis_style, no_successive_maps},
{elvis_style, atom_naming_convention},
{elvis_style, no_throw},
{elvis_style, no_dollar_space},
{elvis_style, no_author},
{elvis_style, no_import},
{elvis_style, no_catch_expressions},
{elvis_style, no_single_clause_case},
{elvis_style, no_match_in_condition},
{elvis_style, numeric_format},
{elvis_style, behaviour_spelling},
{elvis_style, export_used_types},
{elvis_style, max_function_arity},
{elvis_style, max_anonymous_function_arity},
{elvis_style, param_pattern_matching},
{elvis_style, private_data_types}]);
[{elvis_text_style, Rule} || Rule <- [line_length, no_tabs, no_trailing_whitespace]]
++ [{elvis_style, Rule}
|| Rule
<- [atom_naming_convention,
behaviour_spelling,
consistent_variable_casing,
dont_repeat_yourself,
export_used_types,
function_naming_convention,
god_modules,
invalid_dynamic_call,
macro_module_names,
macro_names,
max_anonymous_function_arity,
max_function_arity,
module_naming_convention,
nesting_level,
no_author,
no_behavior_info,
no_block_expressions,
no_catch_expressions,
no_debug_call,
no_dollar_space,
no_if_expression,
no_import,
no_match_in_condition,
no_nested_try_catch,
no_single_clause_case,
no_space,
no_space_after_pound,
no_spec_with_records,
no_successive_maps,
no_throw,
numeric_format,
operator_spaces,
param_pattern_matching,
private_data_types,
used_ignored_variable,
variable_naming_convention]]);
rules(beam_files) ->
lists:map(fun(Rule) -> {elvis_style, Rule, elvis_style:default(Rule)} end,
[nesting_level,
[atom_naming_convention,
behaviour_spelling,
consistent_variable_casing,
dont_repeat_yourself,
export_used_types,
function_naming_convention,
god_modules,
no_if_expression,
invalid_dynamic_call,
used_ignored_variable,
max_anonymous_function_arity,
max_function_arity,
module_naming_convention,
function_naming_convention,
no_spec_with_records,
dont_repeat_yourself,
nesting_level,
no_author,
no_catch_expressions,
no_debug_call,
variable_naming_convention,
consistent_variable_casing,
no_if_expression,
no_import,
no_match_in_condition,
no_nested_try_catch,
no_single_clause_case,
no_spec_with_records,
no_successive_maps,
atom_naming_convention,
no_throw,
no_author,
no_import,
no_catch_expressions,
no_single_clause_case,
no_match_in_condition,
behaviour_spelling,
export_used_types,
max_function_arity,
max_anonymous_function_arity,
param_pattern_matching,
private_data_types]);
private_data_types,
used_ignored_variable,
variable_naming_convention]);
rules(rebar_config) ->
lists:map(fun(Rule) -> {elvis_project, Rule, elvis_project:default(Rule)} end,
[no_branch_deps, protocol_for_deps]);
Expand Down

0 comments on commit 7967ffe

Please sign in to comment.