Merge branch 'fix-warnings' into 'master'
chore: Fix a variety of warnings See merge request mythic-insight/legendary!15
This commit is contained in:
		
						commit
						a9a5a58b8a
					
				
					 11 changed files with 20 additions and 30 deletions
				
			
		| 
						 | 
					@ -11,7 +11,7 @@ defmodule Admin.ErrorHelpersTest do
 | 
				
			||||||
    |> form_for(
 | 
					    |> form_for(
 | 
				
			||||||
      "/example",
 | 
					      "/example",
 | 
				
			||||||
      as: :test_params,
 | 
					      as: :test_params,
 | 
				
			||||||
      errors: [error_field: {"is an error", []}],
 | 
					      errors: [error_field: {"is an error", []}]
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,12 +14,6 @@ defmodule AppWeb.Router do
 | 
				
			||||||
    plug :accepts, ["json"]
 | 
					    plug :accepts, ["json"]
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  scope "/", AppWeb do
 | 
					 | 
				
			||||||
    pipe_through :browser
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    get "/", PageController, :index
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Other scopes may use custom stacks.
 | 
					  # Other scopes may use custom stacks.
 | 
				
			||||||
  # scope "/api", AppWeb do
 | 
					  # scope "/api", AppWeb do
 | 
				
			||||||
  #   pipe_through :api
 | 
					  #   pipe_through :api
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@
 | 
				
			||||||
      Please use the following link to confirm your e-mail address:
 | 
					      Please use the following link to confirm your e-mail address:
 | 
				
			||||||
    <% end %>
 | 
					    <% end %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <%= CoreWeb.EmailHelpers.button href: @url do %>
 | 
					    <%= styled_button href: @url do %>
 | 
				
			||||||
      Confirm my email address
 | 
					      Confirm my email address
 | 
				
			||||||
    <% end %>
 | 
					    <% end %>
 | 
				
			||||||
  <% end %>
 | 
					  <% end %>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@
 | 
				
			||||||
      Please use the following link to reset your password:
 | 
					      Please use the following link to reset your password:
 | 
				
			||||||
    <% end %>
 | 
					    <% end %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <%= CoreWeb.EmailHelpers.button href: @url do %>
 | 
					    <%= styled_button href: @url do %>
 | 
				
			||||||
      Reset my password
 | 
					      Reset my password
 | 
				
			||||||
    <% end %>
 | 
					    <% end %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,6 @@ defmodule AuthWeb.EmailView do
 | 
				
			||||||
    namespace: AuthWeb,
 | 
					    namespace: AuthWeb,
 | 
				
			||||||
    pattern: "**/*"
 | 
					    pattern: "**/*"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  import CoreWeb.EmailHelpers
 | 
					 | 
				
			||||||
  import Phoenix.HTML, only: [raw: 1]
 | 
					  import Phoenix.HTML, only: [raw: 1]
 | 
				
			||||||
 | 
					  import CoreWeb.EmailHelpers
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +0,0 @@
 | 
				
			||||||
<div data-react-component="MenuEditor" data-react-props="<%= %{menu: @menu, posts: @posts, categories: @categories, id: @id} |> Phoenix.json_library().encode!() |> Base.encode64() %>">
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<%= form_for @conn, Routes.menus_path(@conn, :update, @id), [method: :put], fn _f -> %>
 | 
					 | 
				
			||||||
<% end %>
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,6 @@
 | 
				
			||||||
defmodule Content.LayoutView do
 | 
					defmodule Content.LayoutView do
 | 
				
			||||||
  use Content, :view
 | 
					  use Content, :view
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  alias Content.{Option, Options}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  def title(Content.PostsView, "index.html", assigns) do
 | 
					  def title(Content.PostsView, "index.html", assigns) do
 | 
				
			||||||
    "Page #{assigns.page} | #{title(nil, nil, nil)}"
 | 
					    "Page #{assigns.page} | #{title(nil, nil, nil)}"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,8 +158,9 @@ defmodule CoreWeb.EmailHelpers do
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @spec col(number, keyword, [{:do, any}, ...]) :: {:safe, [...]}
 | 
				
			||||||
  def col(n, opts, do: content) do
 | 
					  def col(n, opts, do: content) do
 | 
				
			||||||
    {of, opts} = Keyword.pop!(opts, :of)
 | 
					    {of, _opts} = Keyword.pop!(opts, :of)
 | 
				
			||||||
    width = n * 100.0 / of
 | 
					    width = n * 100.0 / of
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ~E"""
 | 
					    ~E"""
 | 
				
			||||||
| 
						 | 
					@ -225,6 +226,8 @@ defmodule CoreWeb.EmailHelpers do
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def styled_button(opts, do: content), do: button(opts, do: content)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def button(opts, do: content) do
 | 
					  def button(opts, do: content) do
 | 
				
			||||||
    {overrides, opts_without_style} = Keyword.pop(opts, :style, %{})
 | 
					    {overrides, opts_without_style} = Keyword.pop(opts, :style, %{})
 | 
				
			||||||
    {href, _rest_opts} = Keyword.pop!(opts_without_style, :href)
 | 
					    {href, _rest_opts} = Keyword.pop!(opts_without_style, :href)
 | 
				
			||||||
| 
						 | 
					@ -285,9 +288,10 @@ defmodule CoreWeb.EmailHelpers do
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  defp li_for_ul(index, list_length, content) do
 | 
					  defp li_for_ul(index, list_length, content) do
 | 
				
			||||||
    last_styles = if index == list_length - 1, do: map_style(effective_styles(:last_li))
 | 
					    style_type = if index == list_length - 1, do: :last_li, else: :li
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ~E"""
 | 
					    ~E"""
 | 
				
			||||||
      <li style="<%= map_style(effective_styles(:li)) %>">
 | 
					      <li style="<%= map_style(effective_styles(style_type)) %>">
 | 
				
			||||||
        <%= content %>
 | 
					        <%= content %>
 | 
				
			||||||
      </li>
 | 
					      </li>
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,25 +4,24 @@ defmodule CoreWeb.ErrorHelpersTest do
 | 
				
			||||||
  import CoreWeb.ErrorHelpers
 | 
					  import CoreWeb.ErrorHelpers
 | 
				
			||||||
  import Phoenix.HTML, only: [safe_to_string: 1]
 | 
					  import Phoenix.HTML, only: [safe_to_string: 1]
 | 
				
			||||||
  import Phoenix.HTML.Form, only: [form_for: 3]
 | 
					  import Phoenix.HTML.Form, only: [form_for: 3]
 | 
				
			||||||
  import Ecto.Changeset, only: [cast: 3, add_error: 3]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def form do
 | 
					  def form do
 | 
				
			||||||
    :example
 | 
					    :example
 | 
				
			||||||
    |> form_for(
 | 
					    |> form_for(
 | 
				
			||||||
      "/example",
 | 
					      "/example",
 | 
				
			||||||
      as: :test_params,
 | 
					      as: :test_params,
 | 
				
			||||||
      errors: [error_field: {"is an error", []}],
 | 
					      errors: [error_field: {"is an error", []}]
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test "error_class/2" do
 | 
					  test "error_class/2" do
 | 
				
			||||||
    assert error_class(form, :error_field) == "error"
 | 
					    assert error_class(form(), :error_field) == "error"
 | 
				
			||||||
    assert error_class(form, :no_error_field) == ""
 | 
					    assert error_class(form(), :no_error_field) == ""
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test "error_tag/3" do
 | 
					  test "error_tag/3" do
 | 
				
			||||||
    markup =
 | 
					    markup =
 | 
				
			||||||
      form
 | 
					      form()
 | 
				
			||||||
      |> error_tag(:error_field, class: "foobar")
 | 
					      |> error_tag(:error_field, class: "foobar")
 | 
				
			||||||
      |> Enum.at(0)
 | 
					      |> Enum.at(0)
 | 
				
			||||||
      |> safe_to_string()
 | 
					      |> safe_to_string()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ defmodule CoreWeb.HelpersTest do
 | 
				
			||||||
    |> form_for(
 | 
					    |> form_for(
 | 
				
			||||||
      "/example",
 | 
					      "/example",
 | 
				
			||||||
      as: :test_params,
 | 
					      as: :test_params,
 | 
				
			||||||
      errors: [error_field: {"is an error", []}],
 | 
					      errors: [error_field: {"is an error", []}]
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ defmodule CoreWeb.HelpersTest do
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test "styled_input/4 (without error)" do
 | 
					  test "styled_input/4 (without error)" do
 | 
				
			||||||
    markup = safe_to_string(styled_input(form, :no_error_field))
 | 
					    markup = safe_to_string(styled_input(form(), :no_error_field))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert markup =~ ~S{<div class="field "}
 | 
					    assert markup =~ ~S{<div class="field "}
 | 
				
			||||||
    assert markup =~ "<input"
 | 
					    assert markup =~ "<input"
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ defmodule CoreWeb.HelpersTest do
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test "styled_input/4 (with error)" do
 | 
					  test "styled_input/4 (with error)" do
 | 
				
			||||||
    markup = safe_to_string(styled_input(form, :error_field))
 | 
					    markup = safe_to_string(styled_input(form(), :error_field))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert markup =~ ~S{<div class="field error"}
 | 
					    assert markup =~ ~S{<div class="field error"}
 | 
				
			||||||
    assert markup =~ "<input"
 | 
					    assert markup =~ "<input"
 | 
				
			||||||
| 
						 | 
					@ -99,7 +99,7 @@ defmodule CoreWeb.HelpersTest do
 | 
				
			||||||
    options = [{"Test", 1}]
 | 
					    options = [{"Test", 1}]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    markup =
 | 
					    markup =
 | 
				
			||||||
      styled_input(form, :no_error_field, config, options) do
 | 
					      styled_input(form(), :no_error_field, config, options) do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      |> safe_to_string()
 | 
					      |> safe_to_string()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ defmodule Mix.LegendaryTest do
 | 
				
			||||||
      integer_array_input,
 | 
					      integer_array_input,
 | 
				
			||||||
      array_input,
 | 
					      array_input,
 | 
				
			||||||
      other_input,
 | 
					      other_input,
 | 
				
			||||||
    ] = inputs(schema)
 | 
					    ] = inputs(schema())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert reference_input == nil
 | 
					    assert reference_input == nil
 | 
				
			||||||
    assert integer_input =~ ~s(number_input)
 | 
					    assert integer_input =~ ~s(number_input)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue