Skip to content

Commit

Permalink
Remove IO.inspects
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjos committed Jun 14, 2024
1 parent 35bbea7 commit a47fce0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
14 changes: 5 additions & 9 deletions lib/absinthe/phase/document/validation/fields_on_correct_type.ex
Original file line number Diff line number Diff line change
Expand Up @@ -156,27 +156,23 @@ defmodule Absinthe.Phase.Document.Validation.FieldsOnCorrectType do
Generate an error for a field
"""
@spec error_message(String.t(), String.t(), [String.t()], [String.t()]) :: String.t()
def error_message(field_name, type_name, type_suggestions \\ [], field_suggestions \\ []) do
IO.inspect({"error_message", field_name, type_name, type_suggestions, field_suggestions})
def error_message(field_name, type_name, type_suggestions \\ [], field_suggestions \\ [])

do_error_message(field_name, type_name, type_suggestions, field_suggestions)
end

defp do_error_message(field_name, type_name, [], []) do
def error_message(field_name, type_name, [], []) do
~s(Cannot query field "#{field_name}" on type "#{type_name}".)
end

defp do_error_message(field_name, type_name, [], field_suggestions) do
def error_message(field_name, type_name, [], field_suggestions) do
error_message(field_name, type_name) <>
Utils.MessageSuggestions.suggest_message(field_suggestions)
end

defp do_error_message(field_name, type_name, type_suggestions, []) do
def error_message(field_name, type_name, type_suggestions, []) do
error_message(field_name, type_name) <>
Utils.MessageSuggestions.suggest_fragment_message(type_suggestions)
end

defp do_error_message(field_name, type_name, type_suggestions, _) do
def error_message(field_name, type_name, type_suggestions, _) do
error_message(field_name, type_name, type_suggestions)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ defmodule Absinthe.Phase.Document.Validation.Utils.MessageSuggestions do
Generate an suggestions message for a incorrect field
"""
def suggest_message(suggestions) do
IO.inspect({"suggest_message", suggestions})
" Did you mean " <> to_quoted_or_list(suggestions |> Enum.take(@suggest)) <> "?"
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ defmodule Absinthe.Phase.Document.Validation.FieldsOnCorrectTypeTest do
alias Absinthe.Blueprint

defp undefined_field(name, type_name, type_suggestions, field_suggestions, line) do
IO.inspect({"undefined_field", name, type_name, type_suggestions, field_suggestions, line})

bad_value(
Blueprint.Document.Field,
@phase.error_message(name, type_name, type_suggestions, field_suggestions),
Expand Down
7 changes: 1 addition & 6 deletions test/support/validation_phase_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ defmodule Absinthe.ValidationPhaseCase do
import unquote(__MODULE__)

def bad_value(node_kind, message, line, check \\ []) do
IO.inspect({"bad_value", node_kind, message, line, check})

location = unquote(__MODULE__).get_error_location(line)

expectation_banner =
Expand Down Expand Up @@ -79,9 +77,7 @@ defmodule Absinthe.ValidationPhaseCase do

defp node_check_function(check) when is_list(check) do
fn node ->
result = Enum.all?(check, fn {key, value} -> Map.get(node, key) == value end)
IO.inspect({"node_check", check, result})
result
Enum.all?(check, fn {key, value} -> Map.get(node, key) == value end)
end
end

Expand Down Expand Up @@ -199,7 +195,6 @@ defmodule Absinthe.ValidationPhaseCase do
defp error_pairs(input) do
input
|> nodes_with_errors()
|> IO.inspect()
|> Enum.flat_map(fn %{errors: errors} = node ->
Enum.map(errors, &{node, &1})
end)
Expand Down

0 comments on commit a47fce0

Please sign in to comment.