Repository: inaka/elvis_core
Pull request #437: Some minor tweaks for `andalso`/`orelse` "ambiguity"
Author: login: paulo-ferraz-oliveira
Created: 2025-05-29T17:47:31Z | Merged: 2025-05-30T13:10:29Z

# Description

Based on recent discussions and use cases I tweak `elvis_core`'s codebase a bit for the stuff I mention per commit.

Ok to just discuss, close as-is, move forward, or tweak.

- [x] I have read and understood the [contributing guidelines](/inaka/elvis_core/blob/main/CONTRIBUTING.md)



Diff:
diff --git a/rebar.config b/rebar.config
index 26745afc..2641da28 100644
--- a/rebar.config
+++ b/rebar.config
@@ -35,7 +35,7 @@
     {rebar3_hank, "~> 1.4.0"},
     {rebar3_hex, "~> 7.0.7"},
     {erlfmt, "~> v1.6.0"},
-    {rebar3_ex_doc, "~> 0.2.20"}
+    {rebar3_ex_doc, "0.2.28"}
 ]}.
 
 %% == Documentation ==
diff --git a/src/elvis_core.erl b/src/elvis_core.erl
index c101052e..7f962803 100644
--- a/src/elvis_core.erl
+++ b/src/elvis_core.erl
@@ -139,8 +139,10 @@ load_file_data(Config, File) ->
 main([]) ->
     ok = application:load(elvis_core),
     {module, _} = code:ensure_loaded(elvis_style),
-    R = rock(elvis_config:from_file("elvis.config")),
-    R =:= ok orelse halt(1).
+    case rock(elvis_config:from_file("elvis.config")) of
+        ok -> true;
+        _ -> halt(1)
+    end.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%% Private
diff --git a/src/elvis_style.erl b/src/elvis_style.erl
index 5a78cef4..dbc91d5f 100644
--- a/src/elvis_style.erl
+++ b/src/elvis_style.erl
@@ -1196,7 +1196,7 @@ max_module_length(Config, Target, RuleConfig) ->
         end,
     Lines =
         case elvis_utils:split_all_lines(Src, [trim]) of
-            Ls when CountComments andalso CountWhitespace ->
+            Ls when CountComments, CountWhitespace ->
                 Ls;
             Ls ->
                 lists:filter(FilterFun, Ls)
@@ -1880,14 +1880,15 @@ no_single_clause_case(Config, Target, RuleConfig) ->
     ).
 
 is_single_clause_case_statement(Node) ->
-    ktn_code:type(Node) == 'case' andalso
-        length([
-            Clause
-         || SubNode <- ktn_code:content(Node),
-            ktn_code:type(SubNode) == case_clauses,
-            Clause <- ktn_code:content(SubNode)
-        ]) ==
-            1.
+    ktn_code:type(Node) == 'case' andalso length(case_clauses_in(Node)) == 1.
+
+case_clauses_in(Node) ->
+    [
+        Clause
+     || SubNode <- ktn_code:content(Node),
+        ktn_code:type(SubNode) == case_clauses,
+        Clause <- ktn_code:content(SubNode)
+    ].
 
 -type no_single_match_maybe_config() :: #{ignore => [ignorable()]}.
 
@@ -2318,7 +2319,7 @@ check_atom_names(
                 unicode:characters_to_list(AtomName, unicode), RE
             )
         of
-            _ when IsExceptionClass andalso not IsEnclosed ->
+            _ when IsExceptionClass, not IsEnclosed ->
                 AccIn;
             nomatch when not IsEnclosed ->
                 Msg = ?ATOM_NAMING_CONVENTION_MSG,
@@ -2508,7 +2509,7 @@ macro_as_atom(
     _Types,
     _MacroNodeValue
 ) when
-    Type =:= var orelse Type =:= atom
+    Type =:= var; Type =:= atom
 ->
     MacroAsAtom;
 macro_as_atom(false, [Type | OtherTypes], MacroNodeValue) ->
@@ -2534,9 +2535,9 @@ check_spaces(Lines, UnfilteredNodes, {Position, Text}, Encoding, {How0, _} = How
         fun(Node) ->
             Location = ktn_code:attr(location, Node),
             case character_at_location(Position, Lines, Text, Location, Encoding, How) of
-                Char when Char =:= SpaceChar andalso How0 =:= should_have ->
+                Char when Char =:= SpaceChar, How0 =:= should_have ->
                     [];
-                Char when Char =/= SpaceChar andalso How0 =:= should_not_have ->
+                Char when Char =/= SpaceChar, How0 =:= should_not_have ->
                     [];
                 _ when How0 =:= should_have ->
                     Msg = ?MISSING_SPACE_MSG,
@@ -2601,24 +2602,22 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
-        true when How =:= should_have ->
+
+    case {ColToCheck, Position, length(TextLineStr)} of
+        {0, _, _} when How =:= should_have ->
             SpaceChar;
-        true when How =:= should_not_have ->
+        {0, _, _} when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        {_, right, LenLine} when How =:= should_have, ColToCheck > LenLine ->
             SpaceChar;
-        {right, true} when How =:= should_not_have ->
+        {_, right, LenLine} when How =:= should_not_have, ColToCheck > LenLine ->
             "";
+        _ when How =:= should_have ->
+            lists:nth(ColToCheck, TextLineStr);
+        _ when How =:= should_not_have, TextRegex =:= false; TextRegex =:= nomatch ->
+            lists:nth(ColToCheck, TextLineStr);
         _ ->
-            case How of
-                should_have ->
-                    lists:nth(ColToCheck, TextLineStr);
-                should_not_have when TextRegex =:= false orelse TextRegex =:= nomatch ->
-                    lists:nth(ColToCheck, TextLineStr);
-                _ ->
-                    ""
-            end
+            ""
     end.
 
 %% Nesting Level
diff --git a/src/elvis_task.erl b/src/elvis_task.erl
index 526c052d..0674718f 100644
--- a/src/elvis_task.erl
+++ b/src/elvis_task.erl
@@ -22,7 +22,8 @@ chunk_fold({M, F} = FunWork, FunAcc, InitialAcc, ExtraArgs, List, ChunkSize) whe
     is_function(FunAcc, 2),
     is_list(ExtraArgs),
     is_list(List),
-    is_integer(ChunkSize) andalso ChunkSize > 0
+    is_integer(ChunkSize),
+    ChunkSize > 0
 ->
     try
         Term =
diff --git a/src/elvis_utils.erl b/src/elvis_utils.erl
index 1096ef58..ab5a1590 100644
--- a/src/elvis_utils.erl
+++ b/src/elvis_utils.erl
@@ -209,7 +209,7 @@ parse_colors(Message) ->
         },
     Opts = [global, {return, list}],
     case elvis_config:from_application_or_config(output_format, colors) of
-        P when P =:= plain orelse P =:= parsable ->
+        P when P =:= plain; P =:= parsable ->
             re:replace(Message, "{{.*?}}", "", Opts);
         colors ->
             Fun = fun(Key, Acc) ->


Reviews:
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-29T18:05:46Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-29T18:07:05Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-29T18:07:41Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-29T18:08:34Z
user: login: elbrujohalcon
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-30T06:57:18Z
user: login: elbrujohalcon
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-30T06:59:14Z
user: login: elbrujohalcon
body: I had a lot of doubts for approving this one. I like all the `orselse` -> `;` changes, but I don't really like the extra parentheses on boolean operations.
As I said in a comment… I loved how rebar3_format was perfectly aware of precedence in boolean operators (in all operators, actually) and thus it only added parentheses **when they were strictly necessary**.
In any case, I'm approving… if both of you (@paulo-ferraz-oliveira / @bormilan) are happy with the parenthesizing… I accept it :)
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-30T07:09:08Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T11:41:38Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T11:42:49Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T11:43:50Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T11:45:08Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T11:54:49Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T11:56:26Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T11:56:36Z
user: login: elbrujohalcon
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-30T12:03:31Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T12:22:59Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T12:23:16Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T12:27:30Z
user: login: paulo-ferraz-oliveira
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-30T12:33:46Z
user: login: elbrujohalcon
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-30T13:14:50Z
user: login: elbrujohalcon
body: Approved even after merging ✅ 
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-30T13:15:48Z

Review comments:
diff_hunk: @@ -139,7 +139,12 @@ load_file_data(Config, File) ->
 main([]) ->
     ok = application:load(elvis_core),
     R = rock(elvis_config:from_file("elvis.config")),
-    R =:= ok orelse halt(1).
+    case R =:= ok of
path: src/elvis_core.erl
user: login: paulo-ferraz-oliveira
body: @elbrujohalcon, look, I found it 😄 
created_at: 2025-05-29T18:05:46Z
author_association: COLLABORATOR
diff_hunk: @@ -1880,14 +1880,15 @@ no_single_clause_case(Config, Target, RuleConfig) ->
     ).
 
 is_single_clause_case_statement(Node) ->
-    ktn_code:type(Node) == 'case' andalso
-        length([
-            Clause
-         || SubNode <- ktn_code:content(Node),
-            ktn_code:type(SubNode) == case_clauses,
-            Clause <- ktn_code:content(SubNode)
-        ]) ==
-            1.
+    (ktn_code:type(Node) == 'case') andalso (length(case_clauses_in(Node)) == 1).
+
+case_clauses_in(Node) ->
path: src/elvis_style.erl
user: login: paulo-ferraz-oliveira
body: Split it because I kinda felt it hard to read.
created_at: 2025-05-29T18:07:05Z
author_association: COLLABORATOR
diff_hunk: @@ -2601,20 +2596,21 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
+
+    case ColToCheck =:= 0 of
         true when How =:= should_have ->
             SpaceChar;
         true when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        false when How =:= should_have, Position =:= right, ColToCheck > length(TextLineStr) ->
path: src/elvis_style.erl
user: login: paulo-ferraz-oliveira
body: Found another one. This code was **UGLY**, so it might've just been written by me 😄 
created_at: 2025-05-29T18:07:41Z
author_association: COLLABORATOR
diff_hunk: @@ -22,7 +22,8 @@ chunk_fold({M, F} = FunWork, FunAcc, InitialAcc, ExtraArgs, List, ChunkSize) whe
     is_function(FunAcc, 2),
     is_list(ExtraArgs),
     is_list(List),
-    is_integer(ChunkSize) andalso ChunkSize > 0
+    is_integer(ChunkSize),
+    ChunkSize > 0
path: src/elvis_task.erl
user: login: paulo-ferraz-oliveira
body: Makes sense to me to keep the consistency here.
created_at: 2025-05-29T18:08:34Z
author_association: COLLABORATOR
diff_hunk: @@ -139,7 +139,12 @@ load_file_data(Config, File) ->
 main([]) ->
     ok = application:load(elvis_core),
     R = rock(elvis_config:from_file("elvis.config")),
-    R =:= ok orelse halt(1).
+    case R =:= ok of
path: src/elvis_core.erl
user: login: elbrujohalcon
body: 🤦🏻 
created_at: 2025-05-30T06:57:18Z
author_association: MEMBER
diff_hunk: @@ -83,7 +83,7 @@ content_zipper(Root) ->
 -spec all_zipper(ktn_code:tree_node()) -> zipper:zipper(_).
 all_zipper(Root) ->
     IsBranch =
-        fun(#{} = Node) -> ktn_code:content(Node) =/= [] orelse maps:is_key(node_attrs, Node) end,
+        fun(#{} = Node) -> (ktn_code:content(Node) =/= []) orelse maps:is_key(node_attrs, Node) end,
path: src/elvis_code.erl
user: login: elbrujohalcon
body: Oh, how I miss rebar3_format… You could've never get this change through with it. I'm not saying that rebar3_format's style was better or worse… But it was **consistent**. With erlfmt… you can put parentheses sometimes… or not… or maybe?… And it will not _fix_ your code, anyway. 😞 
created_at: 2025-05-30T06:59:14Z
author_association: MEMBER
diff_hunk: @@ -140,7 +140,12 @@ main([]) ->
     ok = application:load(elvis_core),
     {module, _} = code:ensure_loaded(elvis_style),
     R = rock(elvis_config:from_file("elvis.config")),
-    R =:= ok orelse halt(1).
+    case R =:= ok of
+        false ->
+            halt(1);
+        _ ->
+            true
+    end.
path: src/elvis_core.erl
user: login: elbrujohalcon
body: ```suggestion
    case rock(elvis_config:from_file("elvis.config")) of
        ok -> true;
        _ -> halt(1)
    end.
```

It can be simpler.
created_at: 2025-05-30T07:00:45Z
author_association: MEMBER
diff_hunk: @@ -2601,20 +2596,21 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
+
+    case ColToCheck =:= 0 of
         true when How =:= should_have ->
             SpaceChar;
         true when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        false when How =:= should_have, Position =:= right, ColToCheck > length(TextLineStr) ->
path: src/elvis_style.erl
user: login: elbrujohalcon
body: I'm pretty sure this whole `case` statement can be improved by using more pattern-matching a less boolean thingy-ing… Like…

```erlang
case {How, ColToCheck, Position, length(TextLineStr} of
    {should_have, 0, _, _} -> …
```

Even this one is better than the current one, I think…

```erlang
case {ColToCheck, Position, length(TextLineStr} of
    {0, _, _} when How =:= should_have -> …
```
created_at: 2025-05-30T07:04:19Z
author_association: MEMBER
diff_hunk: @@ -22,7 +22,8 @@ chunk_fold({M, F} = FunWork, FunAcc, InitialAcc, ExtraArgs, List, ChunkSize) whe
     is_function(FunAcc, 2),
     is_list(ExtraArgs),
     is_list(List),
-    is_integer(ChunkSize) andalso ChunkSize > 0
+    is_integer(ChunkSize),
+    ChunkSize > 0
path: src/elvis_task.erl
user: login: elbrujohalcon
body: HAHA!! This was a _semantical_ clue… So you can read "ChunkSize is a strictly positive integer" as _a single condition_ 😉 
created_at: 2025-05-30T07:05:54Z
author_association: MEMBER
diff_hunk: @@ -22,7 +22,8 @@ chunk_fold({M, F} = FunWork, FunAcc, InitialAcc, ExtraArgs, List, ChunkSize) whe
     is_function(FunAcc, 2),
     is_list(ExtraArgs),
     is_list(List),
-    is_integer(ChunkSize) andalso ChunkSize > 0
+    is_integer(ChunkSize),
+    ChunkSize > 0
path: src/elvis_task.erl
user: login: elbrujohalcon
body: Yeah… others would use a macro (`?IS_STRICTLY_POSITIVE_INTEGER(ChunkSize)`) for that. I **know**.
In any case, your change is fine.
created_at: 2025-05-30T07:07:04Z
author_association: MEMBER
diff_hunk: @@ -2601,20 +2596,21 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
+
+    case ColToCheck =:= 0 of
         true when How =:= should_have ->
             SpaceChar;
         true when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        false when How =:= should_have, Position =:= right, ColToCheck > length(TextLineStr) ->
path: src/elvis_style.erl
user: login: paulo-ferraz-oliveira
body: I think the only thing that "degrades" performance here is the `length`, since with the `andalso` it won't run unless required. Otherwise I prefer the case approach, too. If that's not a big issue I can go with that and ease reading...
created_at: 2025-05-30T11:41:38Z
author_association: COLLABORATOR
diff_hunk: @@ -22,7 +22,8 @@ chunk_fold({M, F} = FunWork, FunAcc, InitialAcc, ExtraArgs, List, ChunkSize) whe
     is_function(FunAcc, 2),
     is_list(ExtraArgs),
     is_list(List),
-    is_integer(ChunkSize) andalso ChunkSize > 0
+    is_integer(ChunkSize),
+    ChunkSize > 0
path: src/elvis_task.erl
user: login: paulo-ferraz-oliveira
body: I like hidden stuff... sometimes... in that case "when it's a semantical clue" I'd group them with a parens.
created_at: 2025-05-30T11:42:49Z
author_association: COLLABORATOR
diff_hunk: @@ -83,7 +83,7 @@ content_zipper(Root) ->
 -spec all_zipper(ktn_code:tree_node()) -> zipper:zipper(_).
 all_zipper(Root) ->
     IsBranch =
-        fun(#{} = Node) -> ktn_code:content(Node) =/= [] orelse maps:is_key(node_attrs, Node) end,
+        fun(#{} = Node) -> (ktn_code:content(Node) =/= []) orelse maps:is_key(node_attrs, Node) end,
path: src/elvis_code.erl
user: login: paulo-ferraz-oliveira
body: If you prefer I can go back to what-was, i just thought with parens it read easier.
created_at: 2025-05-30T11:43:50Z
author_association: COLLABORATOR
diff_hunk: @@ -140,7 +140,12 @@ main([]) ->
     ok = application:load(elvis_core),
     {module, _} = code:ensure_loaded(elvis_style),
     R = rock(elvis_config:from_file("elvis.config")),
-    R =:= ok orelse halt(1).
+    case R =:= ok of
+        false ->
+            halt(1);
+        _ ->
+            true
+    end.
path: src/elvis_core.erl
user: login: paulo-ferraz-oliveira
body: I'm getting this

> Applying suggestions on deleted lines is currently not supported.

so I'll push "by hand".
created_at: 2025-05-30T11:45:08Z
author_association: COLLABORATOR
diff_hunk: @@ -1880,14 +1880,15 @@ no_single_clause_case(Config, Target, RuleConfig) ->
     ).
 
 is_single_clause_case_statement(Node) ->
-    ktn_code:type(Node) == 'case' andalso
-        length([
-            Clause
-         || SubNode <- ktn_code:content(Node),
-            ktn_code:type(SubNode) == case_clauses,
-            Clause <- ktn_code:content(SubNode)
-        ]) ==
-            1.
+    ktn_code:type(Node) == 'case' andalso length(case_clauses_in(Node)) == 1.
path: src/elvis_style.erl
user: login: paulo-ferraz-oliveira
body: I think this reads better, but lemme know.
created_at: 2025-05-30T11:54:48Z
author_association: COLLABORATOR
diff_hunk: @@ -83,7 +83,7 @@ content_zipper(Root) ->
 -spec all_zipper(ktn_code:tree_node()) -> zipper:zipper(_).
 all_zipper(Root) ->
     IsBranch =
-        fun(#{} = Node) -> ktn_code:content(Node) =/= [] orelse maps:is_key(node_attrs, Node) end,
+        fun(#{} = Node) -> (ktn_code:content(Node) =/= []) orelse maps:is_key(node_attrs, Node) end,
path: src/elvis_code.erl
user: login: paulo-ferraz-oliveira
body: This is now reverted, thus outdated.
created_at: 2025-05-30T11:56:26Z
author_association: COLLABORATOR
diff_hunk: @@ -140,7 +140,12 @@ main([]) ->
     ok = application:load(elvis_core),
     {module, _} = code:ensure_loaded(elvis_style),
     R = rock(elvis_config:from_file("elvis.config")),
-    R =:= ok orelse halt(1).
+    case R =:= ok of
+        false ->
+            halt(1);
+        _ ->
+            true
+    end.
path: src/elvis_core.erl
user: login: paulo-ferraz-oliveira
body: This is worked on.
created_at: 2025-05-30T11:56:36Z
author_association: COLLABORATOR
diff_hunk: @@ -2601,20 +2596,21 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
+
+    case ColToCheck =:= 0 of
         true when How =:= should_have ->
             SpaceChar;
         true when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        false when How =:= should_have, Position =:= right, ColToCheck > length(TextLineStr) ->
path: src/elvis_style.erl
user: login: elbrujohalcon
body: Yeah… let's go with that one.
created_at: 2025-05-30T12:03:31Z
author_association: MEMBER
diff_hunk: @@ -2601,20 +2596,21 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
+
+    case ColToCheck =:= 0 of
         true when How =:= should_have ->
             SpaceChar;
         true when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        false when How =:= should_have, Position =:= right, ColToCheck > length(TextLineStr) ->
path: src/elvis_style.erl
user: login: paulo-ferraz-oliveira
body: I pushed the untanglement.
created_at: 2025-05-30T12:22:58Z
author_association: COLLABORATOR
diff_hunk: @@ -2601,20 +2596,21 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
+
+    case ColToCheck =:= 0 of
         true when How =:= should_have ->
             SpaceChar;
         true when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        false when How =:= should_have, Position =:= right, ColToCheck > length(TextLineStr) ->
path: src/elvis_style.erl
user: login: paulo-ferraz-oliveira
body: (and with it I even got rid of an extra `case` expr)
created_at: 2025-05-30T12:23:15Z
author_association: COLLABORATOR
diff_hunk: @@ -2601,20 +2596,21 @@ character_at_location(
     % NOTE: text below only applies when the given Position is equal to `right`,
     %       or Position is equal to `left` and Col is 1.
     SpaceChar = $\s,
-    case ColToCheck =:= 0 orelse {Position, ColToCheck > length(TextLineStr)} of
+
+    case ColToCheck =:= 0 of
         true when How =:= should_have ->
             SpaceChar;
         true when How =:= should_not_have ->
             "";
-        {right, true} when How =:= should_have ->
+        false when How =:= should_have, Position =:= right, ColToCheck > length(TextLineStr) ->
path: src/elvis_style.erl
user: login: paulo-ferraz-oliveira
body: I pushed a change for this.
created_at: 2025-05-30T12:27:30Z
author_association: COLLABORATOR
diff_hunk: @@ -35,7 +35,7 @@
     {rebar3_hank, "~> 1.4.0"},
     {rebar3_hex, "~> 7.0.7"},
     {erlfmt, "~> v1.6.0"},
-    {rebar3_ex_doc, "~> 0.2.20"}
+    {rebar3_ex_doc, "0.2.20"}
path: rebar.config
user: login: paulo-ferraz-oliveira
body: This is probably not your favorite, but if it helps in reproducibility I think we should keep it, since it appears it just broke for us given a recent release.
created_at: 2025-05-30T12:33:46Z
author_association: COLLABORATOR
diff_hunk: @@ -35,7 +35,7 @@
     {rebar3_hank, "~> 1.4.0"},
     {rebar3_hex, "~> 7.0.7"},
     {erlfmt, "~> v1.6.0"},
-    {rebar3_ex_doc, "~> 0.2.20"}
+    {rebar3_ex_doc, "0.2.20"}
path: rebar.config
user: login: elbrujohalcon
body: Fine with me.
created_at: 2025-05-30T13:14:49Z
author_association: MEMBER

PR comments:
user: login: paulo-ferraz-oliveira
created_at: 2025-05-30T11:52:44Z
body: I'm reverting all the changes to parens. It was a consequence of previous changes, but not relevant in this context.
author_association: COLLABORATOR
user: login: paulo-ferraz-oliveira
created_at: 2025-05-30T12:27:06Z
body: Something's crashing OTP 25 on `escriptize`; I'm trying with OTP 26+ to see if I can spot anything.
author_association: COLLABORATOR
user: login: paulo-ferraz-oliveira
created_at: 2025-05-30T13:05:47Z
body: This became much smaller in scope, so when CI passes I'm merging; I wanna make sure I'm not introducing merge conflicts to the other open PR 😄 
author_association: COLLABORATOR