Skip to content

Commit

Permalink
remove the following warnings
Browse files Browse the repository at this point in the history
```
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
```
  • Loading branch information
ma2gedev committed Sep 11, 2018
1 parent 78b2b6b commit 23426b9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/power_assert/assertion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ defmodule PowerAssert.Assertion do
{ast, %{detector | in_fn: detector.in_fn + 1}}
end
@ignore_ops [:., :__aliases__, :|>, :==, :!=, :<, :>, :>=, :<=, :*, :||, :&&, :<>, :===, :!==, :and, :or, :=~, :%{}, :%, :->, :|, :{}]
defp pre_collect_position({func, _, args} = ast, detector) when not func in @ignore_ops and is_atom(func) and is_list(args) do
defp pre_collect_position({func, _, args} = ast, detector) when not(func in @ignore_ops) and is_atom(func) and is_list(args) do
case Atom.to_string(func) do
<<"sigil_", _name>> ->
{ast, %{detector | in_fn: detector.in_fn + 1}}
Expand Down Expand Up @@ -281,7 +281,7 @@ defmodule PowerAssert.Assertion do
# import List
# [1, 2] |> first()
# ^
defp collect_position({func, _, args} = ast, %Detector{in_fn: in_fn} = detector) when not func in @ignore_ops and is_atom(func) and is_list(args) and in_fn > 0 do
defp collect_position({func, _, args} = ast, %Detector{in_fn: in_fn} = detector) when not(func in @ignore_ops) and is_atom(func) and is_list(args) and in_fn > 0 do
case Atom.to_string(func) do
# not supported sigils
<<"sigil_", _name>> ->
Expand All @@ -290,7 +290,7 @@ defmodule PowerAssert.Assertion do
{ast, detector}
end
end
defp collect_position({func, _, args} = ast, detector) when not func in @ignore_ops and is_atom(func) and is_list(args) do
defp collect_position({func, _, args} = ast, detector) when not(func in @ignore_ops) and is_atom(func) and is_list(args) do
func_code = Macro.to_string(ast)
matches = Regex.scan(~r/(?<!\.)#{Regex.escape(func_code)}/, detector.code, return: :index)
positions = insert_pos_unless_exist(detector.positions, matches, func_code)
Expand Down Expand Up @@ -366,7 +366,7 @@ defmodule PowerAssert.Assertion do
defp pre_catcher({func, _, [_, _]} = ast, injector) when func in @unsupported_func_arity2 do
{ast, %{injector | in_fn: injector.in_fn + 1}}
end
defp pre_catcher({func, _, args} = ast, injector) when not func in @ignore_ops and is_atom(func) and is_list(args) do
defp pre_catcher({func, _, args} = ast, injector) when not(func in @ignore_ops) and is_atom(func) and is_list(args) do
case Atom.to_string(func) do
<<"sigil_", _name>> ->
{ast, %{injector | in_fn: injector.in_fn + 1}}
Expand Down Expand Up @@ -441,15 +441,15 @@ defmodule PowerAssert.Assertion do
{ast, %{injector | in_fn: injector.in_fn - 1}}
end
end
defp catcher({func, _, args} = ast, %Injector{positions: [_h|_t], in_fn: in_fn} = injector) when not func in @ignore_ops and is_atom(func) and is_list(args) and in_fn > 0 do
defp catcher({func, _, args} = ast, %Injector{positions: [_h|_t], in_fn: in_fn} = injector) when not(func in @ignore_ops) and is_atom(func) and is_list(args) and in_fn > 0 do
case Atom.to_string(func) do
<<"sigil_", _name>> ->
{ast, %{injector | in_fn: injector.in_fn - 1}}
_ ->
{ast, injector}
end
end
defp catcher({func, _, args} = ast, %Injector{positions: [[pos, _]|t]} = injector) when not func in @ignore_ops and is_atom(func) and is_list(args) do
defp catcher({func, _, args} = ast, %Injector{positions: [[pos, _]|t]} = injector) when not(func in @ignore_ops) and is_atom(func) and is_list(args) do
{store_value_ast(ast, pos), %{injector | positions: t}}
end
defp catcher({variable, _, el} = ast, %Injector{in_fn: in_fn} = injector) when is_atom(variable) and is_atom(el) and in_fn > 0, do: {ast, injector}
Expand Down

0 comments on commit 23426b9

Please sign in to comment.