Fix Credo warnings
authorRoman Chvanikov <chvanikoff@gmail.com>
Sat, 20 Apr 2019 12:57:43 +0000 (19:57 +0700)
committerRoman Chvanikov <chvanikoff@gmail.com>
Sat, 20 Apr 2019 12:57:43 +0000 (19:57 +0700)
lib/pleroma/application.ex
lib/pleroma/digest_email_worker.ex
lib/pleroma/web/mailer/subscription_controller.ex
mix.exs
test/notification_test.exs

index 76f8d9bcdfa8fb185b9e0212e036dbb271e72a2b..299f8807b51f449009d7c50abbface68c4fc7164 100644 (file)
@@ -187,7 +187,7 @@ defmodule Pleroma.Application do
     end
   end
 
-  defp after_supervisor_start() do
+  defp after_supervisor_start do
     with digest_config <- Application.get_env(:pleroma, :email_notifications)[:digest],
          true <- digest_config[:active],
          %Crontab.CronExpression{} = schedule <-
index fa6067a0325f436d3d3a00bff012b639350e1525..7be470f5f5279dca7f3ebeed7399eca38c567670 100644 (file)
@@ -4,7 +4,7 @@ defmodule Pleroma.DigestEmailWorker do
 
   # alias Pleroma.User
 
-  def run() do
+  def run do
     Logger.warn("Running digester")
     config = Application.get_env(:pleroma, :email_notifications)[:digest]
     negative_interval = -Map.fetch!(config, :interval)
@@ -14,7 +14,7 @@ defmodule Pleroma.DigestEmailWorker do
     now = NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
 
     from(u in inactive_users_query,
-      where: fragment("? #> '{\"email_notifications\",\"digest\"}' @> 'true'", u.info),
+      where: fragment(~s(? #> '{"email_notifications","digest"}' @> 'true'), u.info),
       where: u.last_digest_emailed_at < datetime_add(^now, ^negative_interval, "day"),
       select: u
     )
index 2334ebacba7927063c38ac750f153654ae5ac851..478a835187186f05d49b53885978402b11052fd5 100644 (file)
@@ -1,7 +1,9 @@
 defmodule Pleroma.Web.Mailer.SubscriptionController do
   use Pleroma.Web, :controller
 
-  alias Pleroma.{JWT, Repo, User}
+  alias Pleroma.JWT
+  alias Pleroma.Repo
+  alias Pleroma.User
 
   def unsubscribe(conn, %{"token" => encoded_token}) do
     with {:ok, token} <- Base.decode64(encoded_token),
diff --git a/mix.exs b/mix.exs
index 6bb1055380f1ee30293025977f7ddb44f610cc8c..2cdfb139209c04379f9d3cdcf41313076248b5a8 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -8,7 +8,7 @@ defmodule Pleroma.Mixfile do
       elixir: "~> 1.7",
       elixirc_paths: elixirc_paths(Mix.env()),
       compilers: [:phoenix, :gettext] ++ Mix.compilers(),
-      elixirc_options: [warnings_as_errors: true],
+      elixirc_options: [warnings_as_errors: true],
       xref: [exclude: [:eldap]],
       start_permanent: Mix.env() == :prod,
       aliases: aliases(),
index 462398d7512bd05bde046e298a9981ab531e764c..3bbce8fcf87e54cd3d7d312ced568a9e3971a084 100644 (file)
@@ -335,7 +335,7 @@ defmodule Pleroma.NotificationTest do
       recent_notifications_ids =
         user2
         |> Notification.for_user_since(
-          NaiveDateTime.add(NaiveDateTime.utc_now(), -5 * 86400, :second)
+          NaiveDateTime.add(NaiveDateTime.utc_now(), -5 * 86_400, :second)
         )
         |> Enum.map(& &1.id)