Skip to content

Commit

Permalink
Pipes: allow ^ as a valid start. Closes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed May 4, 2023
1 parent acf762b commit 793fd6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/style/pipes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ defmodule Styler.Style.Pipes do

# most of these values were lifted directly from credoa's pipe_chain_start.ex
@literal ~w(__block__ __aliases__ unquote)a
@value_constructors ~w(% %{} .. <<>> @ {} & fn from)a
@value_constructors ~w(% %{} .. <<>> @ {} ^ & fn from)a
@infix_ops ~w(++ -- && || in - * + / > < <= >= ==)a
@binary_ops ~w(<> <- ||| &&& <<< >>> <<~ ~>> <~ ~> <~> <|> ^^^ ~~~)a
@valid_starts @literal ++ @value_constructors ++ @infix_ops ++ @binary_ops
Expand Down
4 changes: 3 additions & 1 deletion test/style/pipes_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,16 @@ defmodule Styler.Style.PipesTest do
assert_style("Module.foo() |> bar() |> baz()")
end

test "allows ecto's from" do
test "ecto funtimes" do
for from <- ~w(from Query.from Ecto.Query.from) do
assert_style("""
#{from}(foo in Bar, where: foo.bool)
|> some_query_helper()
|> Repo.all()
""")
end

assert_style("^foo |> Ecto.Query.bar() |> Ecto.Query.baz()")
end
end

Expand Down

0 comments on commit 793fd6e

Please sign in to comment.