Skip to content

Commit

Permalink
fix regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
bormilan committed Dec 9, 2024
1 parent 25e9b73 commit 199ba15
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/style_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ verify_function_naming_convention(Config) ->
elvis_core_apply_rule(Config,
elvis_style,
function_naming_convention,
#{regex => "^[a-z](_?[a-z0-9]+)*$", forbidden_regex => "[0-9]"},
#{regex => DefaultRegex, forbidden_regex => "[0-9]"},
PathForbidden).

-spec verify_variable_naming_convention(config()) -> any().
verify_variable_naming_convention(Config) ->
Ext = proplists:get_value(test_file_ext, Config, "erl"),

RuleConfig = #{regex => "^_?([A-Z][0-9a-zA-Z]*)$"},
#{regex := DefaultRegex} = elvis_style:default(variable_naming_convention),

PathPass = "pass_variable_naming_convention." ++ Ext,
[] =
Expand Down Expand Up @@ -227,7 +228,7 @@ verify_variable_naming_convention(Config) ->
elvis_core_apply_rule(Config,
elvis_style,
variable_naming_convention,
#{regex => "^_?([A-Z][0-9a-zA-Z]*)$", forbidden_regex => "[0-9]"},
#{regex => DefaultRegex, forbidden_regex => "[0-9]"},
PathForbidden).

-spec verify_consistent_variable_casing(config()) -> any().
Expand Down Expand Up @@ -720,8 +721,7 @@ verify_module_naming_convention(Config) ->
elvis_core_apply_rule(Config,
elvis_style,
module_naming_convention,
#{regex => "^[a-z](_?[a-z0-9]+)*(_SUITE)?$",
forbidden_regex => "[0-9]"},
#{regex => DefaultRegex, forbidden_regex => "[0-9]"},
PathForbidden).

-spec verify_state_record_and_type(config()) -> any().
Expand Down Expand Up @@ -1465,6 +1465,8 @@ verify_atom_naming_convention(Config) ->
Group = proplists:get_value(group, Config, erl_files),
Ext = proplists:get_value(test_file_ext, Config, "erl"),

#{regex := DefaultRegex} = elvis_style:default(atom_naming_convention),

BaseRegex = "^[a-z](_?[a-z0-9]+)*(_SUITE)?$",

% pass
Expand Down Expand Up @@ -1602,24 +1604,22 @@ verify_atom_naming_convention(Config) ->
elvis_core_apply_rule(Config,
elvis_style,
atom_naming_convention,
#{regex => "^[a-z](_?[a-z0-9]+)*(_SUITE)?$",
forbidden_regex => "[0-9]"},
#{regex => DefaultRegex, forbidden_regex => "[0-9]"},
PathForbidden);
erl_files ->
[_, _, _] =
elvis_core_apply_rule(Config,
elvis_style,
atom_naming_convention,
#{regex => "^[a-z](_?[a-z0-9]+)*(_SUITE)?$",
forbidden_regex => "[0-9]"},
#{regex => DefaultRegex, forbidden_regex => "[0-9]"},
PathForbidden)
end,

[_, _, _, _] =
elvis_core_apply_rule(Config,
elvis_style,
atom_naming_convention,
#{regex => "^[a-z](_?[a-z0-9]+)*(_SUITE)?$",
#{regex => DefaultRegex,
forbidden_regex => "[0-9]",
forbidden_enclosed_regex => same},
PathForbidden).
Expand Down

0 comments on commit 199ba15

Please sign in to comment.