diff --git a/doc_rules/elvis_style/no_debug_call.md b/doc_rules/elvis_style/no_debug_call.md index 27b8b4fa..3645fa34 100644 --- a/doc_rules/elvis_style/no_debug_call.md +++ b/doc_rules/elvis_style/no_debug_call.md @@ -17,9 +17,9 @@ lead to performance degradation, unwanted output, or inconsistent logging behavi - default: `[{ct, pal}, {ct, print}, {io, format, 1}, {io, format, 2}, {erlang, display, 1}, {io, put_chars, 1}, {io, put_chars, 2}]` -`{erlang, display, 1}` was added in [1.5.0](https://github.com/inaka/elvis_core/releases/tag/1.5.0)). +`{erlang, display, 1}` was added in [1.5.0](https://github.com/inaka/elvis_core/releases/tag/1.5.0). -`{io, put_chars, 1}, {io, put_chars, 2}` was added in [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0)). +`{io, put_chars, 1}, {io, put_chars, 2}` was added in [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0). ## Example configuration diff --git a/doc_rules/elvis_style/no_space.md b/doc_rules/elvis_style/no_space.md index cd386789..44ecf9b6 100644 --- a/doc_rules/elvis_style/no_space.md +++ b/doc_rules/elvis_style/no_space.md @@ -34,7 +34,7 @@ codebase. - default: `[{right, "("}, {left, ")"}, {left, ","}, {left, ":"}, {right, "#"}, {right, "?"}, {right, "?"}]` -`{right, "#"}, {right, "?"}` was added in [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0)). +`{right, "#"}, {right, "?"}` was added in [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0). ## Example configuration diff --git a/doc_rules/elvis_style/operator_spaces.md b/doc_rules/elvis_style/operator_spaces.md index 970646b4..72d60376 100644 --- a/doc_rules/elvis_style/operator_spaces.md +++ b/doc_rules/elvis_style/operator_spaces.md @@ -22,43 +22,44 @@ compromised without adequate spacing. - default: ```erlang - [{left, "!"}, {right, "!"}, {left, "*"}, {right, "*"} - , {left, "+"}, {right, "+"}, {left, "++"}, {right, "++"} - , {left, "-"}, {right, "-"}, {left, "--"}, {right, "--"} - , {left, "->"}, {right, "->"}, {left, "/"}, {right, "/"} - , {left, "/="}, {right, "/="}, {left, "::"}, {right, "::"} - , {left, ":="}, {right, ":="}, {left, "<"}, {right, "<"} - , {left, "<-"}, {right, "<-"}, {left, "<="}, {right, "<="} - , {left, "="}, {right, "="}, {left, "=/="}, {right, "=/="} - , {left, "=:="}, {right, "=:="}, {left, "=<"}, {right, "=<"} - , {left, "=="}, {right, "=="}, {left, "=>"}, {right, "=>"} - , {left, ">"}, {right, ">"}, {left, ">="}, {right, ">="} - , {left, "|"}, {right, "|"}, {left, "||"}, {right, "||"} - , {right, ","}] + [{right, "++"}, {left, "++"}, {right, "="}, {left, "="} + , {right, "+"}, {left, "+"}, {right, "-"}, {left, "-"} + , {right, "*"}, {left, "*"}, {right, "/"}, {left, "/"} + , {right, "=<"}, {left, "=<"}, {right, "<"}, {left, "<"} + , {right, ">"}, {left, ">"}, {right, ">="}, {left, ">="} + , {right, "=="}, {left, "=="}, {right, "=:="}, {left, "=:="} + , {right, "/="}, {left, "/="}, {right, "=/="}, {left, "=/="} + , {right, "--"}, {left, "--"}, {right, "=>"}, {left, "=>"} + , {right, ":="}, {left, ":="}, {right, "<-"}, {left, "<-"} + , {right, "<="}, {left, "<="}, {right, "||"}, {left, "||"} + , {right, "|"}, {left, "|"}, {right, "::"}, {left, "::"} + , {right, "->"}, {left, "->"}, {right, ","}, {right, "!"} + , {left, "!"}, {right, "?="}, {left, "?="} + ] ``` `rules` was `[{right, ","}, {right, "++"}, {left, "++"}]` until [1.5.0](https://github.com/inaka/elvis_core/releases/tag/1.5.0). -`{left, "!"}, {right, "!"}` was added in [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0)). +`{right, "!"}, {left, "!"}` was added in [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0). -`{left, "?="}, {right, "?="}` was added in [4.1.0](https://github.com/inaka/elvis_core/releases/tag/4.1.0)). +`{right, "?="}, {left, "?="}` was added in [4.1.0](https://github.com/inaka/elvis_core/releases/tag/4.1.0). ## Example configuration ```erlang -{elvis_style, operator_spaces, #{ rules => [{left, "!"}, {right, "!"}, {left, "*"}, {right, "*"} - , {left, "+"}, {right, "+"}, {left, "++"}, {right, "++"} - , {left, "-"}, {right, "-"}, {left, "--"}, {right, "--"} - , {left, "->"}, {right, "->"}, {left, "/"}, {right, "/"} - , {left, "/="}, {right, "/="}, {left, "::"}, {right, "::"} - , {left, ":="}, {right, ":="}, {left, "<"}, {right, "<"} - , {left, "<-"}, {right, "<-"}, {left, "<="}, {right, "<="} - , {left, "="}, {right, "="}, {left, "=/="}, {right, "=/="} - , {left, "=:="}, {right, "=:="}, {left, "=<"}, {right, "=<"} - , {left, "=="}, {right, "=="}, {left, "=>"}, {right, "=>"} - , {left, ">"}, {right, ">"}, {left, ">="}, {right, ">="} - , {left, "|"}, {right, "|"}, {left, "||"}, {right, "||"} - , {right, ","} +{elvis_style, operator_spaces, #{ rules => [{right, "++"}, {left, "++"}, {right, "="}, {left, "="} + , {right, "+"}, {left, "+"}, {right, "-"}, {left, "-"} + , {right, "*"}, {left, "*"}, {right, "/"}, {left, "/"} + , {right, "=<"}, {left, "=<"}, {right, "<"}, {left, "<"} + , {right, ">"}, {left, ">"}, {right, ">="}, {left, ">="} + , {right, "=="}, {left, "=="}, {right, "=:="}, {left, "=:="} + , {right, "/="}, {left, "/="}, {right, "=/="}, {left, "=/="} + , {right, "--"}, {left, "--"}, {right, "=>"}, {left, "=>"} + , {right, ":="}, {left, ":="}, {right, "<-"}, {left, "<-"} + , {right, "<="}, {left, "<="}, {right, "||"}, {left, "||"} + , {right, "|"}, {left, "|"}, {right, "::"}, {left, "::"} + , {right, "->"}, {left, "->"}, {right, ","}, {right, "!"} + , {left, "!"}, {right, "?="}, {left, "?="} ] }} ``` diff --git a/doc_rules/elvis_style/state_record_and_type.md b/doc_rules/elvis_style/state_record_and_type.md index 9dbc5aa6..9220e34f 100644 --- a/doc_rules/elvis_style/state_record_and_type.md +++ b/doc_rules/elvis_style/state_record_and_type.md @@ -6,6 +6,7 @@ corresponding state type (public - `type()` - or private - `opaque`). - `gen_server` - `gen_event` [![](https://img.shields.io/badge/since-0.7.0-blue)](https://github.com/inaka/elvis_core/releases/tag/0.7.0) - `gen_fsm` +- `gen_statem` [![](https://img.shields.io/badge/since-0.7.0-blue)](https://github.com/inaka/elvis_core/releases/tag/0.7.0) - `supervisor_bridge` **Note**: if used together with `export_used_types`, the `state` record **should be** defined as a diff --git a/src/elvis_style.erl b/src/elvis_style.erl index 6911346e..92a8135a 100644 --- a/src/elvis_style.erl +++ b/src/elvis_style.erl @@ -344,8 +344,8 @@ default(operator_spaces) -> {right, "->"}, {left, "->"}, {right, ","}, - {left, "!"}, {right, "!"}, + {left, "!"}, {right, "?="}, {left, "?="} ] diff --git a/test/examples/fail_macro_module_names.erl b/test/examples/fail_macro_module_names.erl index 4850792a..40d63220 100644 --- a/test/examples/fail_macro_module_names.erl +++ b/test/examples/fail_macro_module_names.erl @@ -22,9 +22,6 @@ module_name() -> ?MODULE:function_name(), ?module_name:?function_name(), - ?module_name:function_name(with, arguments), - ?MODULE:?function_name(with, arguments), - ?module_name:?function_name(with, arguments), ?function_name(with, arguments). function_name() -> diff --git a/test/examples/fail_used_ignored_variable.erl b/test/examples/fail_used_ignored_variable.erl index d5dabb0a..5827c455 100644 --- a/test/examples/fail_used_ignored_variable.erl +++ b/test/examples/fail_used_ignored_variable.erl @@ -1,11 +1,7 @@ -module(fail_used_ignored_variable). --if(?OTP_RELEASE >= 25). - -feature(maybe_expr, enable). --endif. - -export([ use_ignored_var/2 , use_ignored_var_in_fun/2 , no_used_ignored_vars_here/2, handle_call/3 @@ -14,8 +10,6 @@ -elvis([{elvis_style, no_macros, #{allow => ['__']}}]). --if(?OTP_RELEASE >= 25). - -export([no_used_ignored_vars_in_maybe/2]). no_used_ignored_vars_in_maybe(One, _Two) -> @@ -25,8 +19,6 @@ no_used_ignored_vars_in_maybe(One, _Two) -> One end. --endif. - use_ignored_var(_One, Two) -> Three = _One + Two, case Three of diff --git a/test/examples/no_init_lists_examples/fail_no_init_lists5.erl b/test/examples/no_init_lists_examples/fail_no_init_lists5.erl index 07f34ca2..91b653b5 100644 --- a/test/examples/no_init_lists_examples/fail_no_init_lists5.erl +++ b/test/examples/no_init_lists_examples/fail_no_init_lists5.erl @@ -1,5 +1,6 @@ -module(fail_no_init_lists5). +-if(?OTP_RELEASE < 28). -behaviour(gen_fsm). -export([init/1, handle_sync_event/4, handle_event/3]). @@ -9,4 +10,4 @@ init([]) -> {error, "Don't use list for init/1"}. handle_sync_event(_, _, _, _) -> ok. handle_event(_, _, _) -> ok. - +-endif. diff --git a/test/examples/pass_maybe.erl b/test/examples/pass_maybe.erl index f8bafc3f..aea79559 100644 --- a/test/examples/pass_maybe.erl +++ b/test/examples/pass_maybe.erl @@ -1,15 +1,9 @@ -module(pass_maybe). --if(?OTP_RELEASE >= 25). - -feature(maybe_expr, enable). --endif. - -export([sum_numbers/2]). - --if(?OTP_RELEASE >= 25). sum_numbers(Number1, Number2) -> maybe ValidNumber1 ?= validate_number(Number1), @@ -24,7 +18,3 @@ validate_number(Number) when is_number(Number) -> Number; validate_number(_) -> {error, invalid_number}. --else. -sum_numbers(Number1, Number2) -> - Number1 + Number2. --endif. diff --git a/test/style_SUITE.erl b/test/style_SUITE.erl index 8f680b16..200035d2 100644 --- a/test/style_SUITE.erl +++ b/test/style_SUITE.erl @@ -557,13 +557,9 @@ verify_macro_module_names(Config) -> [ #{line_num := 24}, #{line_num := 24}, - #{line_num := 25}, - #{line_num := 26}, - #{line_num := 27}, - #{line_num := 27}, - #{line_num := 31}, - #{line_num := 32}, - #{line_num := 33} + #{line_num := 28}, + #{line_num := 29}, + #{line_num := 30} ] = elvis_core_apply_rule(Config, elvis_style, macro_module_names, #{}, Path). @@ -725,8 +721,8 @@ verify_operator_spaces(Config) -> #{info := [left, "||" | _]}, #{info := [right, "|" | _]}, #{info := [left, "|" | _]}, - #{info := [left, "!" | _]}, #{info := [right, "!" | _]}, + #{info := [left, "!" | _]}, #{info := [right, "?=" | _]}, #{info := [left, "?=" | _]} ] = @@ -923,7 +919,7 @@ verify_used_ignored_variable(Config) -> [#{line_num := _}, #{line_num := _}, #{line_num := _}, #{line_num := _}] = elvis_core_apply_rule(Config, elvis_style, used_ignored_variable, #{}, Path); erl_files -> - [#{line_num := 31}, #{line_num := 34}, #{line_num := 38}, #{line_num := 38}] = + [#{line_num := 23}, #{line_num := 26}, #{line_num := 30}, #{line_num := 30}] = elvis_core_apply_rule(Config, elvis_style, used_ignored_variable, #{}, Path), [] = elvis_core_apply_rule(Config, elvis_style, used_ignored_variable, #{}, Path2) end,