inaka / elvis_core

The core of an Erlang linter
Other
61 stars 56 forks source link

no_match_in_condition reports a warning even when the condition includes a valid match #311

Closed elbrujohalcon closed 3 weeks ago

elbrujohalcon commented 1 year ago

Bug Description

In the scenario below, the rule should not emit a warning.

To Reproduce

Run Elvis on…

-module(x).

-export([valid/1]).

valid(List) ->
    case lists:all(fun ({K, V}) ->
                           Something = find:something(for, K),
                           check:something(V, Something)
                   end,
                   List)
        of
        true -> all_true;
        false -> found_a_bad_one
    end.

You'll get…

# src/x.erl [FAIL]
  - no_match_in_condition (https://github.com/inaka/elvis_core/tree/main/doc_rules/elvis_style/no_match_in_condition.md)
    - Case statement with a match in its condition found on line 6.

Expected Behavior

No warnings.