chore: Address a variety of warnings

This commit is contained in:
Robert Prehn 2021-08-04 16:32:13 -05:00
parent 0e7514f922
commit 912fe4e024
9 changed files with 11725 additions and 11659 deletions

3
.dialyzer_ignore.exs Normal file
View file

@ -0,0 +1,3 @@
[
{"lib/i18n.ex:1:pattern_match_cov The pattern pattern <_@1, _@2, _@3> can never match the type, because it is covered by previous clauses."}
]

File diff suppressed because it is too large Load diff

View file

@ -4,10 +4,6 @@ defmodule AppWeb.LiveHelpers do
"""
import Phoenix.LiveView
alias Legendary.Auth.User
alias Pow.Store.CredentialsCache
alias AppWeb.Pow.Routes
def assign_defaults(socket, session) do
assign_new(socket, :current_user, fn -> get_user(socket, session) end)
end
@ -16,7 +12,7 @@ defmodule AppWeb.LiveHelpers do
if socket.assigns.current_user do
socket
else
redirect(socket, to: Routes.after_sign_out_path(%Plug.Conn{}))
redirect(socket, to: "/")
end
end

View file

@ -7,12 +7,11 @@ defmodule Legendary.Content.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec
# Define workers and child supervisors to be supervised
children = [
# Start the Ecto repository
supervisor(Legendary.Content.Repo, []),
Legendary.Content.Repo,
# Start the endpoint when the application starts
# Start your own worker by calling: Legendary.Content.Worker.start_link(arg1, arg2, arg3)
# worker(Legendary.Content.Worker, [arg1, arg2, arg3]),

View file

@ -24,8 +24,14 @@ defmodule AuthWeb.Pow.ControllerCallbacks do
end
def before_respond(Pow.Phoenix.SessionController, :delete, {:ok, conn}, config) do
live_socket_id = Conn.get_session(conn, :live_socket_id)
AppWeb.Endpoint.broadcast(live_socket_id, "disconnect", %{})
case Conn.get_session(conn, :live_socket_id) do
nil ->
nil
live_socket_id ->
%{private: %{phoenix_endpoint: endpoint}} = conn
apply(endpoint, :broadcast, [live_socket_id, "disconnect", %{}])
end
conn =
conn

View file

@ -18,7 +18,11 @@ defmodule Legendary.Core.SharedDBConnectionPool do
def child_spec({mod, opts}) do
opts = Keyword.put_new(opts, :name, key(opts))
Supervisor.Spec.worker(Legendary.Core.SharedDBConnectionPool, [{mod, opts}])
%{
id: __MODULE__,
start: {Legendary.Core.SharedDBConnectionPool, :start_link, [{mod, opts}]}
}
end
defp key(opts) do

View file

@ -138,6 +138,7 @@ defmodule Legendary.Core.MixProject do
{:bamboo, "~> 1.5"},
{:bamboo_smtp, "~> 3.0"},
{:credo, "~> 1.4", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev], runtime: false},
{:ex_cldr, "~> 2.13.0"},
{:ex_doc, "~> 0.24", only: :dev, runtime: false},
{:excoveralls, "~> 0.10", only: [:dev, :test]},

View file

@ -13,6 +13,10 @@ defmodule Legendary.Mixfile do
deps: deps(),
test_coverage: [tool: ExCoveralls],
aliases: aliases(),
dialyzer: [
plt_add_apps: [:mix],
ignore_warnings: ".dialyzer_ignore.exs"
],
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,

View file

@ -65,7 +65,7 @@
"phoenix_live_view": {:hex, :phoenix_live_view, "0.15.7", "09720b8e5151b3ca8ef739cd7626d4feb987c69ba0b509c9bbdb861d5a365881", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.5.7", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 0.5", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a756cf662420272d0f1b3b908cce5222163b5a95aa9bab404f9d29aff53276e"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
"php_serializer": {:hex, :php_serializer, "2.0.0", "b43f31aca22ed7321f32da2b94fe2ddf9b6739a965cb51541969119e572e821d", [:mix], [], "hexpm", "61e402e99d9062c0225a3f4fcf7e43b4cba1b8654944c0e7c139c3ca9de481da"},
"plug": {:hex, :plug, "1.12.0", "39dc7f1ef8c46bb1bf6dd8f6a49f526c45b4b92ce553687fd885b559a46d0230", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5282c76e89efdf43f2e04bd268ca99d738039f9518137f02ff468cee3ba78096"},
"plug": {:hex, :plug, "1.12.1", "645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b"},
"plug_cowboy": {:hex, :plug_cowboy, "2.5.1", "7cc96ff645158a94cf3ec9744464414f02287f832d6847079adfe0b58761cbd0", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "107d0a5865fa92bcb48e631cc0729ae9ccfa0a9f9a1bd8f01acb513abf1c2d64"},
"plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"},
"postgrex": {:hex, :postgrex, "0.15.5", "aec40306a622d459b01bff890fa42f1430dac61593b122754144ad9033a2152f", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "ed90c81e1525f65a2ba2279dbcebf030d6d13328daa2f8088b9661eb9143af7f"},