Merge branch 'fix/credo-issues' into 'develop'
authorkaniini <nenolod@gmail.com>
Sun, 10 Feb 2019 20:54:21 +0000 (20:54 +0000)
committerkaniini <nenolod@gmail.com>
Sun, 10 Feb 2019 20:54:21 +0000 (20:54 +0000)
Fix credo issues

See merge request pleroma/pleroma!786

73 files changed:
.credo.exs
lib/mix/tasks/pleroma/uploads.ex
lib/mix/tasks/pleroma/user.ex
lib/pleroma/PasswordResetToken.ex
lib/pleroma/activity.ex
lib/pleroma/captcha/captcha.ex
lib/pleroma/emails/user_email.ex
lib/pleroma/filter.ex
lib/pleroma/flake_id.ex
lib/pleroma/formatter.ex
lib/pleroma/gopher/server.ex
lib/pleroma/html.ex
lib/pleroma/instances/instance.ex
lib/pleroma/list.ex
lib/pleroma/notification.ex
lib/pleroma/object.ex
lib/pleroma/plugs/instance_static.ex
lib/pleroma/plugs/oauth_plug.ex
lib/pleroma/plugs/uploaded_media.ex
lib/pleroma/plugs/user_fetcher_plug.ex
lib/pleroma/stats.ex
lib/pleroma/upload.ex
lib/pleroma/upload/filter/dedupe.ex
lib/pleroma/uploaders/s3.ex
lib/pleroma/user.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/activity_pub_controller.ex
lib/pleroma/web/activity_pub/relay.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/activity_pub/utils.ex
lib/pleroma/web/activity_pub/views/object_view.ex
lib/pleroma/web/activity_pub/views/user_view.ex
lib/pleroma/web/common_api/common_api.ex
lib/pleroma/web/common_api/utils.ex
lib/pleroma/web/federator/federator.ex
lib/pleroma/web/http_signatures/http_signatures.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/views/account_view.ex
lib/pleroma/web/mastodon_api/views/filter_view.ex
lib/pleroma/web/mastodon_api/views/status_view.ex
lib/pleroma/web/mastodon_api/websocket_handler.ex
lib/pleroma/web/media_proxy/controller.ex
lib/pleroma/web/media_proxy/media_proxy.ex
lib/pleroma/web/metadata/opengraph.ex
lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
lib/pleroma/web/oauth/app.ex
lib/pleroma/web/oauth/authorization.ex
lib/pleroma/web/oauth/oauth_controller.ex
lib/pleroma/web/oauth/token.ex
lib/pleroma/web/ostatus/activity_representer.ex
lib/pleroma/web/ostatus/feed_representer.ex
lib/pleroma/web/ostatus/handlers/follow_handler.ex
lib/pleroma/web/ostatus/handlers/note_handler.ex
lib/pleroma/web/ostatus/handlers/unfollow_handler.ex
lib/pleroma/web/ostatus/ostatus.ex
lib/pleroma/web/ostatus/ostatus_controller.ex
lib/pleroma/web/push/push.ex
lib/pleroma/web/push/subscription.ex
lib/pleroma/web/rich_media/helpers.ex
lib/pleroma/web/salmon/salmon.ex
lib/pleroma/web/streamer.ex
lib/pleroma/web/twitter_api/controllers/util_controller.ex
lib/pleroma/web/twitter_api/representers/activity_representer.ex
lib/pleroma/web/twitter_api/twitter_api.ex
lib/pleroma/web/twitter_api/twitter_api_controller.ex
lib/pleroma/web/twitter_api/views/activity_view.ex
lib/pleroma/web/twitter_api/views/notification_view.ex
lib/pleroma/web/twitter_api/views/user_view.ex
lib/pleroma/web/uploader_controller.ex
lib/pleroma/web/web.ex
lib/pleroma/web/web_finger/web_finger.ex
lib/pleroma/web/websub/websub.ex
lib/pleroma/web/websub/websub_controller.ex

index b1f2a6164a6007e3c4406be0ec5b0eff3caa1f46..94e19c4b5b0710298bbab058f924004a25185d13 100644 (file)
@@ -57,7 +57,7 @@
 
         # For some checks, like AliasUsage, you can only customize the priority
         # Priority values are: `low, normal, high, higher`
-        {Credo.Check.Design.AliasUsage, priority: :low},
+        {Credo.Check.Design.AliasUsage, priority: :low, if_called_more_often_than: 3},
 
         # For others you can set parameters
 
         {Credo.Check.Warning.BoolOperationOnSameValues},
         {Credo.Check.Warning.IExPry},
         {Credo.Check.Warning.IoInspect},
-        {Credo.Check.Warning.LazyLogging},
+        # Got too much of them, not sure if relevant
+        {Credo.Check.Warning.LazyLogging, false},
         {Credo.Check.Warning.OperationOnSameValues},
         {Credo.Check.Warning.OperationWithConstantResult},
         {Credo.Check.Warning.UnusedEnumOperation},
index f0eb13e1aa97fe6a822b120b64565a0908fd9568..a01e616278ab1f8cd2c5ea6c333698e73e29a5a4 100644 (file)
@@ -4,7 +4,8 @@
 
 defmodule Mix.Tasks.Pleroma.Uploads do
   use Mix.Task
-  alias Pleroma.{Upload, Uploaders.Local}
+  alias Pleroma.Upload
+  alias Pleroma.Uploaders.Local
   alias Mix.Tasks.Pleroma.Common
   require Logger
 
@@ -20,7 +21,7 @@ defmodule Mix.Tasks.Pleroma.Uploads do
    - `--delete` - delete local uploads after migrating them to the target uploader
 
 
-   A list of avalible uploaders can be seen in config.exs
+   A list of available uploaders can be seen in config.exs
   """
   def run(["migrate_local", target_uploader | args]) do
     delete? = Enum.member?(args, "--delete")
@@ -96,6 +97,7 @@ defmodule Mix.Tasks.Pleroma.Uploads do
       timeout: 150_000
     )
     |> Stream.chunk_every(@log_every)
+    # credo:disable-for-next-line Credo.Check.Warning.UnusedEnumOperation
     |> Enum.reduce(0, fn done, count ->
       count = count + length(done)
       Mix.shell().info("Uploaded #{count}/#{total_count} files")
index ffc45fd037d2fe0f1336962385255449d4a5d49a..037e4471679d5f6ce780b80437964f49fa38c661 100644 (file)
@@ -5,7 +5,8 @@
 defmodule Mix.Tasks.Pleroma.User do
   use Mix.Task
   import Ecto.Changeset
-  alias Pleroma.{Repo, User}
+  alias Pleroma.Repo
+  alias Pleroma.User
   alias Mix.Tasks.Pleroma.Common
 
   @shortdoc "Manages Pleroma users"
@@ -211,7 +212,7 @@ defmodule Mix.Tasks.Pleroma.User do
 
       user = Repo.get(User, user.id)
 
-      if length(user.following) == 0 do
+      if Enum.empty?(user.following) do
         Mix.shell().info("Successfully unsubscribed all followers from #{user.nickname}")
       end
     else
index c3c0384d234d803311047d9779288bdc559460dc..750ddd3c04645e3714face400e0cbbc42bb6ebe8 100644 (file)
@@ -7,7 +7,9 @@ defmodule Pleroma.PasswordResetToken do
 
   import Ecto.Changeset
 
-  alias Pleroma.{User, PasswordResetToken, Repo}
+  alias Pleroma.User
+  alias Pleroma.Repo
+  alias Pleroma.PasswordResetToken
 
   schema "password_reset_tokens" do
     belongs_to(:user, User, type: Pleroma.FlakeId)
index f0aa3ce978f437c854b66b49cbedc9b248760a05..cdfe7ea9e482c9a36b332ce312801af7615a352b 100644 (file)
@@ -4,7 +4,11 @@
 
 defmodule Pleroma.Activity do
   use Ecto.Schema
-  alias Pleroma.{Repo, Activity, Notification}
+
+  alias Pleroma.Repo
+  alias Pleroma.Activity
+  alias Pleroma.Notification
+
   import Ecto.Query
 
   @type t :: %__MODULE__{}
index 0207bcbea6261df88c000bb8d7b9d27d9c42ab2e..aa41acd1ab21cfdf61cfb4e01675993ea5703299 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Captcha do
+  alias Calendar.DateTime
   alias Plug.Crypto.KeyGenerator
   alias Plug.Crypto.MessageEncryptor
-  alias Calendar.DateTime
 
   use GenServer
 
index c42c53c9996faef5d39bfc10ec382f74d86ad509..a3a09e96cccebda630c8ee86b4c534789dc7e949 100644 (file)
@@ -7,7 +7,8 @@ defmodule Pleroma.UserEmail do
 
   import Swoosh.Email
 
-  alias Pleroma.Web.{Endpoint, Router}
+  alias Pleroma.Web.Endpoint
+  alias Pleroma.Web.Router
 
   defp instance_config, do: Pleroma.Config.get(:instance)
 
index 308bd70e1956c02fe224249e44c9d6c2382ede4b..bdc34698c13098c09d1cc31906819a6a53ded780 100644 (file)
@@ -4,8 +4,12 @@
 
 defmodule Pleroma.Filter do
   use Ecto.Schema
-  import Ecto.{Changeset, Query}
-  alias Pleroma.{User, Repo}
+
+  import Ecto.Changeset
+  import Ecto.Query
+
+  alias Pleroma.User
+  alias Pleroma.Repo
 
   schema "filters" do
     belongs_to(:user, User, type: Pleroma.FlakeId)
index 69ab8ccf929f10184968a009f76fce5aa3384392..9f098ce3378f0ce5deeb2ea2bb03e9804e56f80d 100644 (file)
@@ -27,7 +27,7 @@ defmodule Pleroma.FlakeId do
     Kernel.to_string(id)
   end
 
-  def to_string(flake = <<_::integer-size(64), _::integer-size(48), _::integer-size(16)>>) do
+  def to_string(<<_::integer-size(64), _::integer-size(48), _::integer-size(16)>> = flake) do
     encode_base62(flake)
   end
 
@@ -42,7 +42,7 @@ defmodule Pleroma.FlakeId do
     def from_string(unquote(Kernel.to_string(i))), do: <<0::integer-size(128)>>
   end
 
-  def from_string(flake = <<_::integer-size(128)>>), do: flake
+  def from_string(<<_::integer-size(128)>> = flake), do: flake
 
   def from_string(string) when is_binary(string) and byte_size(string) < 18 do
     case Integer.parse(string) do
index 386096a52b2ad4dfbf94ccf32685b1b734fd8ac2..f31aafa0dbd3f530a767619f5b81cc39751a4542 100644 (file)
@@ -3,10 +3,10 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Formatter do
+  alias Pleroma.Emoji
+  alias Pleroma.HTML
   alias Pleroma.User
   alias Pleroma.Web.MediaProxy
-  alias Pleroma.HTML
-  alias Pleroma.Emoji
 
   @tag_regex ~r/((?<=[^&])|\A)(\#)(\w+)/u
   @markdown_characters_regex ~r/(`|\*|_|{|}|[|]|\(|\)|#|\+|-|\.|!)/
index 336142e9b288aa7160bcc5f3c6b5a884a7b2a932..32cb817d253a639d318ae94f7d0cef494a342428 100644 (file)
@@ -37,17 +37,17 @@ end
 
 defmodule Pleroma.Gopher.Server.ProtocolHandler do
   alias Pleroma.Web.ActivityPub.ActivityPub
-  alias Pleroma.User
   alias Pleroma.Activity
-  alias Pleroma.Repo
   alias Pleroma.HTML
+  alias Pleroma.User
+  alias Pleroma.Repo
 
   def start_link(ref, socket, transport, opts) do
     pid = spawn_link(__MODULE__, :init, [ref, socket, transport, opts])
     {:ok, pid}
   end
 
-  def init(ref, socket, transport, _Opts = []) do
+  def init(ref, socket, transport, [] = _Opts) do
     :ok = :ranch.accept_ack(ref)
     loop(socket, transport)
   end
index b4a4742ee30c39699e0ecaf079a8226415ead5f3..4dc6998b12e770170115392d19fc095ded160767 100644 (file)
@@ -83,8 +83,7 @@ defmodule Pleroma.HTML.Scrubber.TwitterText do
   """
 
   @markup Application.get_env(:pleroma, :markup)
-  @uri_schemes Application.get_env(:pleroma, :uri_schemes, [])
-  @valid_schemes Keyword.get(@uri_schemes, :valid_schemes, [])
+  @valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
 
   require HtmlSanitizeEx.Scrubber.Meta
   alias HtmlSanitizeEx.Scrubber.Meta
@@ -126,10 +125,11 @@ defmodule Pleroma.HTML.Scrubber.Default do
 
   require HtmlSanitizeEx.Scrubber.Meta
   alias HtmlSanitizeEx.Scrubber.Meta
+  # credo:disable-for-previous-line
+  # No idea how to fix this one…
 
   @markup Application.get_env(:pleroma, :markup)
-  @uri_schemes Application.get_env(:pleroma, :uri_schemes, [])
-  @valid_schemes Keyword.get(@uri_schemes, :valid_schemes, [])
+  @valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
 
   Meta.remove_cdata_sections_before_scrub()
   Meta.strip_comments()
index 4a4ca26dd731b3b8a0ddec7e4e06346e2fcaaff3..48bc939dd0958aa5748d46cb09a7d5403a18c87e 100644 (file)
@@ -2,13 +2,13 @@ defmodule Pleroma.Instances.Instance do
   @moduledoc "Instance."
 
   alias Pleroma.Instances
+  alias Pleroma.Repo
   alias Pleroma.Instances.Instance
 
   use Ecto.Schema
 
-  import Ecto.{Query, Changeset}
-
-  alias Pleroma.Repo
+  import Ecto.Query
+  import Ecto.Changeset
 
   schema "instances" do
     field(:host, :string)
index ca66c69160605590546e2f66e3bc53c46649a509..55c4cf6df16fde340043cd4a214363828cadcebc 100644 (file)
@@ -4,8 +4,13 @@
 
 defmodule Pleroma.List do
   use Ecto.Schema
-  import Ecto.{Changeset, Query}
-  alias Pleroma.{User, Repo, Activity}
+
+  import Ecto.Query
+  import Ecto.Changeset
+
+  alias Pleroma.Activity
+  alias Pleroma.Repo
+  alias Pleroma.User
 
   schema "lists" do
     belongs_to(:user, User, type: Pleroma.FlakeId)
index 2364d36da0a4a03f43018b17b9e9d114bd821389..c7c925c890a16c4c93fbfdd55a02b3b57259950c 100644 (file)
@@ -4,8 +4,13 @@
 
 defmodule Pleroma.Notification do
   use Ecto.Schema
-  alias Pleroma.{User, Activity, Notification, Repo}
+
+  alias Pleroma.User
+  alias Pleroma.Activity
+  alias Pleroma.Notification
+  alias Pleroma.Repo
   alias Pleroma.Web.CommonAPI.Utils
+
   import Ecto.Query
 
   schema "notifications" do
index 96079cf229a7e24af2d2ebb97f098ac06610840f..dabb495364277fdd0299a5e185db8947f26fd8bc 100644 (file)
@@ -4,8 +4,15 @@
 
 defmodule Pleroma.Object do
   use Ecto.Schema
-  alias Pleroma.{Repo, Object, User, Activity, ObjectTombstone}
-  import Ecto.{Query, Changeset}
+
+  alias Pleroma.Repo
+  alias Pleroma.Object
+  alias Pleroma.User
+  alias Pleroma.Activity
+  alias Pleroma.ObjectTombstone
+
+  import Ecto.Query
+  import Ecto.Changeset
 
   schema "objects" do
     field(:data, :map)
index 11f108de74f46ac8f20bfeca839d23476bc88fcd..41125921a9818ae1a5a045bfa85ffae3dd445f9f 100644 (file)
@@ -33,7 +33,7 @@ defmodule Pleroma.Plugs.InstanceStatic do
   for only <- @only do
     at = Plug.Router.Utils.split("/")
 
-    def call(conn = %{request_path: "/" <> unquote(only) <> _}, opts) do
+    def call(%{request_path: "/" <> unquote(only) <> _} = conn, opts) do
       call_static(
         conn,
         opts,
index 945a1d49f7d05fe149e9afcb8372a14dee69199f..22f0406f4637cfc486a1a86155903667b8b7729c 100644 (file)
@@ -6,11 +6,9 @@ defmodule Pleroma.Plugs.OAuthPlug do
   import Plug.Conn
   import Ecto.Query
 
-  alias Pleroma.{
-    User,
-    Repo,
-    Web.OAuth.Token
-  }
+  alias Pleroma.User
+  alias Pleroma.Repo
+  alias Pleroma.Web.OAuth.Token
 
   @realm_reg Regex.compile!("Bearer\:?\s+(.*)$", "i")
 
index be53ac00cd7ae8a62e386a4584879b5fe19f6d76..13aa8641afcb2444d195ac87298d98fbb2c8f589 100644 (file)
@@ -23,7 +23,7 @@ defmodule Pleroma.Plugs.UploadedMedia do
     %{static_plug_opts: static_plug_opts}
   end
 
-  def call(conn = %{request_path: <<"/", @path, "/", file::binary>>}, opts) do
+  def call(%{request_path: <<"/", @path, "/", file::binary>>} = conn, opts) do
     config = Pleroma.Config.get([Pleroma.Upload])
 
     with uploader <- Keyword.fetch!(config, :uploader),
index f874e2f95a3fd8fb836af99ccdbdd237abf85651..7ed4602bbd2a5c43e4a96aba0b975657f05a4958 100644 (file)
@@ -3,9 +3,10 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Plugs.UserFetcherPlug do
-  import Plug.Conn
-  alias Pleroma.Repo
   alias Pleroma.User
+  alias Pleroma.Repo
+
+  import Plug.Conn
 
   def init(options) do
     options
index b3566ceb63d686a818bdccb4cdff17c9cf9b3131..fe0ce9051a9e3359849cb6b63fbbd808aa0ab434 100644 (file)
@@ -4,7 +4,8 @@
 
 defmodule Pleroma.Stats do
   import Ecto.Query
-  alias Pleroma.{User, Repo}
+  alias Pleroma.User
+  alias Pleroma.Repo
 
   def start_link do
     agent = Agent.start_link(fn -> {[], %{}} end, name: __MODULE__)
@@ -23,7 +24,7 @@ defmodule Pleroma.Stats do
   def schedule_update do
     spawn(fn ->
       # 1 hour
-      Process.sleep(1000 * 60 * 60 * 1)
+      Process.sleep(1000 * 60 * 60)
       schedule_update()
     end)
 
index ce2a1b69633344607415767f4d58bb9ffdfda8af..91a5db8c524f6e24b4b122c267cc5afd0a7c1a38 100644 (file)
@@ -180,7 +180,7 @@ defmodule Pleroma.Upload do
   end
 
   # For Mix.Tasks.MigrateLocalUploads
-  defp prepare_upload(upload = %__MODULE__{tempfile: path}, _opts) do
+  defp prepare_upload(%__MODULE__{tempfile: path} = upload, _opts) do
     with {:ok, content_type} <- Pleroma.MIME.file_mime_type(path) do
       {:ok, %__MODULE__{upload | content_type: content_type}}
     end
index 8fcce320f57db7974808f919ed01aa7bec6c3eef..e4c2258334e3a4aa754d7bbffd232df7f3be0feb 100644 (file)
@@ -6,7 +6,7 @@ defmodule Pleroma.Upload.Filter.Dedupe do
   @behaviour Pleroma.Upload.Filter
   alias Pleroma.Upload
 
-  def filter(upload = %Upload{name: name}) do
+  def filter(%Upload{name: name} = upload) do
     extension = String.split(name, ".") |> List.last()
     shasum = :crypto.hash(:sha256, File.read!(upload.tempfile)) |> Base.encode16(case: :lower)
     filename = shasum <> "." <> extension
index fbd89616c5b1e7f462c7f75e143fe486973e8ea1..0038ba01fdc0104bf3f06df637be60ed985ddc12 100644 (file)
@@ -27,7 +27,7 @@ defmodule Pleroma.Uploaders.S3 do
       ])}}
   end
 
-  def put_file(upload = %Pleroma.Upload{}) do
+  def put_file(%Pleroma.Upload{} = upload) do
     config = Pleroma.Config.get([__MODULE__])
     bucket = Keyword.get(config, :bucket)
 
index 3610348876d6c2a0ee769dd40b64386fdfc2946c..0060d966bd17289cdfe7fba93dd88acbc7f192a9 100644 (file)
@@ -5,13 +5,23 @@
 defmodule Pleroma.User do
   use Ecto.Schema
 
-  import Ecto.{Changeset, Query}
-  alias Pleroma.{Repo, User, Object, Web, Activity, Notification}
+  import Ecto.Changeset
+  import Ecto.Query
+
+  alias Pleroma.Repo
+  alias Pleroma.User
+  alias Pleroma.Object
+  alias Pleroma.Web
+  alias Pleroma.Activity
+  alias Pleroma.Notification
   alias Comeonin.Pbkdf2
   alias Pleroma.Formatter
   alias Pleroma.Web.CommonAPI.Utils, as: CommonUtils
-  alias Pleroma.Web.{OStatus, Websub, OAuth}
-  alias Pleroma.Web.ActivityPub.{Utils, ActivityPub}
+  alias Pleroma.Web.OStatus
+  alias Pleroma.Web.Websub
+  alias Pleroma.Web.OAuth
+  alias Pleroma.Web.ActivityPub.Utils
+  alias Pleroma.Web.ActivityPub.ActivityPub
 
   require Logger
 
index b33912721782fb05cfbf3f32ee0fed3b7f2412b8..c46d8233e04aa77dfef3a4da5e0d49d66679454f 100644 (file)
@@ -3,13 +3,22 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.ActivityPub.ActivityPub do
-  alias Pleroma.{Activity, Repo, Object, Upload, User, Notification, Instances}
-  alias Pleroma.Web.ActivityPub.{Transmogrifier, MRF}
+  alias Pleroma.Activity
+  alias Pleroma.Repo
+  alias Pleroma.Object
+  alias Pleroma.Upload
+  alias Pleroma.User
+  alias Pleroma.Notification
+  alias Pleroma.Instances
+  alias Pleroma.Web.ActivityPub.Transmogrifier
+  alias Pleroma.Web.ActivityPub.MRF
   alias Pleroma.Web.WebFinger
   alias Pleroma.Web.Federator
   alias Pleroma.Web.OStatus
+
   import Ecto.Query
   import Pleroma.Web.ActivityPub.Utils
+
   require Logger
 
   @httpoison Application.get_env(:pleroma, :httpoison)
@@ -19,19 +28,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   defp get_recipients(%{"type" => "Announce"} = data) do
     to = data["to"] || []
     cc = data["cc"] || []
-    recipients = to ++ cc
     actor = User.get_cached_by_ap_id(data["actor"])
 
-    recipients
-    |> Enum.filter(fn recipient ->
-      case User.get_cached_by_ap_id(recipient) do
-        nil ->
-          true
-
-        user ->
-          User.following?(user, actor)
-      end
-    end)
+    recipients =
+      (to ++ cc)
+      |> Enum.filter(fn recipient ->
+        case User.get_cached_by_ap_id(recipient) do
+          nil ->
+            true
+
+          user ->
+            User.following?(user, actor)
+        end
+      end)
 
     {recipients, to, cc}
   end
@@ -119,7 +128,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
           activity.data["object"]
           |> Map.get("tag", [])
           |> Enum.filter(fn tag -> is_bitstring(tag) end)
-          |> Enum.map(fn tag -> Pleroma.Web.Streamer.stream("hashtag:" <> tag, activity) end)
+          |> Enum.each(fn tag -> Pleroma.Web.Streamer.stream("hashtag:" <> tag, activity) end)
 
           if activity.data["object"]["attachment"] != [] do
             Pleroma.Web.Streamer.stream("public:media", activity)
index 2cdf132e2dc998520548ed70d654ca1881ee36f9..69879476eb4b26f855d3b65d373c410f20c454ec 100644 (file)
@@ -5,12 +5,15 @@
 defmodule Pleroma.Web.ActivityPub.ActivityPubController do
   use Pleroma.Web, :controller
 
-  alias Pleroma.{Activity, User, Object}
-  alias Pleroma.Web.ActivityPub.{ObjectView, UserView}
+  alias Pleroma.Activity
+  alias Pleroma.User
+  alias Pleroma.Object
+  alias Pleroma.Web.ActivityPub.ObjectView
+  alias Pleroma.Web.ActivityPub.UserView
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.ActivityPub.Relay
-  alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.ActivityPub.Transmogrifier
+  alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.Federator
 
   require Logger
index c0a52e349ea423460a5c1c9f52e7fba7e376447f..c496063ea1cd89ba95cf92a519d297f1144f5a10 100644 (file)
@@ -3,7 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.ActivityPub.Relay do
-  alias Pleroma.{User, Object, Activity}
+  alias Pleroma.User
+  alias Pleroma.Object
+  alias Pleroma.Activity
   alias Pleroma.Web.ActivityPub.ActivityPub
   require Logger
 
index 7151efdeb79774b1356403b4f7e291601b77098a..98a2af8198dc1b25a11b315ec83d2819415c80a4 100644 (file)
@@ -6,9 +6,9 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   @moduledoc """
   A module to handle coding from internal to wire ActivityPub and back.
   """
+  alias Pleroma.Activity
   alias Pleroma.User
   alias Pleroma.Object
-  alias Pleroma.Activity
   alias Pleroma.Repo
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.ActivityPub.Utils
index 134701e80597f95002fa79c9a0fdc95bdbf39e59..da6cca4ddd4052b93013b8c0c3b30a4fd88002b0 100644 (file)
@@ -3,11 +3,19 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.ActivityPub.Utils do
-  alias Pleroma.{Repo, Web, Object, Activity, User, Notification}
+  alias Pleroma.Repo
+  alias Pleroma.Web
+  alias Pleroma.Object
+  alias Pleroma.Activity
+  alias Pleroma.User
+  alias Pleroma.Notification
   alias Pleroma.Web.Router.Helpers
   alias Pleroma.Web.Endpoint
-  alias Ecto.{Changeset, UUID}
+  alias Ecto.Changeset
+  alias Ecto.UUID
+
   import Ecto.Query
+
   require Logger
 
   @supported_object_types ["Article", "Note", "Video", "Page"]
index 394d82fbca48d12eca7f57ff06498d8956cd7867..84fa94e327a052bd6930b6fda6b961e846f32275 100644 (file)
@@ -4,7 +4,8 @@
 
 defmodule Pleroma.Web.ActivityPub.ObjectView do
   use Pleroma.Web, :view
-  alias Pleroma.{Object, Activity}
+  alias Pleroma.Activity
+  alias Pleroma.Object
   alias Pleroma.Web.ActivityPub.Transmogrifier
 
   def render("object.json", %{object: %Object{} = object}) do
index 43ec2010d711f131b5ae19579a97ec87d894599d..15e6c1f687c5ee755b7a2bc759e9cf90ff4235ff 100644 (file)
@@ -4,13 +4,15 @@
 
 defmodule Pleroma.Web.ActivityPub.UserView do
   use Pleroma.Web, :view
-  alias Pleroma.Web.Salmon
+
   alias Pleroma.Web.WebFinger
+  alias Pleroma.Web.Salmon
   alias Pleroma.User
   alias Pleroma.Repo
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.ActivityPub.Transmogrifier
   alias Pleroma.Web.ActivityPub.Utils
+
   import Ecto.Query
 
   # the instance itself is not a Person, but instead an Application
index 7084da6deca42948351e1fe5547cdda9bb91e3ed..c0d6fb5c4743272b6be60f892c599030fa07a3c4 100644 (file)
@@ -3,7 +3,10 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.CommonAPI do
-  alias Pleroma.{User, Repo, Activity, Object}
+  alias Pleroma.User
+  alias Pleroma.Repo
+  alias Pleroma.Activity
+  alias Pleroma.Object
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Formatter
index 208677bd755857f7b31af1dc113123a02be10839..123107b56441a216c8589f29dcd10ce3978d855f 100644 (file)
@@ -5,12 +5,15 @@
 defmodule Pleroma.Web.CommonAPI.Utils do
   alias Calendar.Strftime
   alias Comeonin.Pbkdf2
-  alias Pleroma.{Activity, Formatter, Object, Repo}
+  alias Pleroma.Activity
+  alias Pleroma.Formatter
+  alias Pleroma.Object
+  alias Pleroma.Repo
   alias Pleroma.User
   alias Pleroma.Web
-  alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.Endpoint
   alias Pleroma.Web.MediaProxy
+  alias Pleroma.Web.ActivityPub.Utils
 
   # This is a hack for twidere.
   def get_by_id_or_ap_id(id) do
@@ -95,7 +98,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
   def make_context(%Activity{data: %{"context" => context}}), do: context
   def make_context(_), do: Utils.generate_context_id()
 
-  def maybe_add_attachments(text, _attachments, _no_links = true), do: text
+  def maybe_add_attachments(text, _attachments, true = _no_links), do: text
 
   def maybe_add_attachments(text, attachments, _no_links) do
     add_attachments(text, attachments)
index bb7676cf00be5ab0b1d22c3fa9b5f33cc45f6a62..468959a65f34883b55d07593d149b043374195eb 100644 (file)
@@ -4,15 +4,19 @@
 
 defmodule Pleroma.Web.Federator do
   use GenServer
-  alias Pleroma.User
+
   alias Pleroma.Activity
-  alias Pleroma.Web.{WebFinger, Websub, Salmon}
-  alias Pleroma.Web.Federator.RetryQueue
+  alias Pleroma.User
+  alias Pleroma.Web.WebFinger
+  alias Pleroma.Web.Websub
+  alias Pleroma.Web.Salmon
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.ActivityPub.Relay
   alias Pleroma.Web.ActivityPub.Transmogrifier
   alias Pleroma.Web.ActivityPub.Utils
+  alias Pleroma.Web.Federator.RetryQueue
   alias Pleroma.Web.OStatus
+
   require Logger
 
   @websub Application.get_env(:pleroma, :websub)
@@ -25,7 +29,7 @@ defmodule Pleroma.Web.Federator do
   def start_link do
     spawn(fn ->
       # 1 minute
-      Process.sleep(1000 * 60 * 1)
+      Process.sleep(1000 * 60)
       enqueue(:refresh_subscriptions, nil)
     end)
 
@@ -196,8 +200,7 @@ defmodule Pleroma.Web.Federator do
     {:noreply, %{in: {i_running_jobs, i_queue}, out: {o_running_jobs, o_queue}}}
   end
 
-  def handle_cast(m, state) do
-    IO.inspect("Unknown: #{inspect(m)}, #{inspect(state)}")
+  def handle_cast(_, state) do
     {:noreply, state}
   end
 
index e81f9e27a3e3782d8d7325dfdd7d036b12198b7e..8e2e2a44b8ca71bf8208a05f89e3824dec401dfb 100644 (file)
@@ -5,8 +5,9 @@
 # https://tools.ietf.org/html/draft-cavage-http-signatures-08
 defmodule Pleroma.Web.HTTPSignatures do
   alias Pleroma.User
-  alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.ActivityPub.ActivityPub
+  alias Pleroma.Web.ActivityPub.Utils
+
   require Logger
 
   def split_signature(sig) do
index dbe7c25542b061601211d8ae3c50d246ddc9510a..06f8703935674c887cb323d3a0ed0cc8a9ec064a 100644 (file)
@@ -4,23 +4,31 @@
 
 defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   use Pleroma.Web, :controller
-  alias Pleroma.{Repo, Object, Activity, User, Notification, Stats}
+  alias Pleroma.Activity
+  alias Pleroma.Config
+  alias Pleroma.Filter
+  alias Pleroma.Notification
+  alias Pleroma.Object
+  alias Pleroma.Repo
+  alias Pleroma.Stats
+  alias Pleroma.User
   alias Pleroma.Web
-
-  alias Pleroma.Web.MastodonAPI.{
-    StatusView,
-    AccountView,
-    MastodonView,
-    ListView,
-    FilterView,
-    PushSubscriptionView
-  }
-
-  alias Pleroma.Web.ActivityPub.ActivityPub
-  alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.CommonAPI
-  alias Pleroma.Web.OAuth.{Authorization, Token, App}
   alias Pleroma.Web.MediaProxy
+  alias Pleroma.Web.Push
+  alias Push.Subscription
+
+  alias Pleroma.Web.MastodonAPI.AccountView
+  alias Pleroma.Web.MastodonAPI.FilterView
+  alias Pleroma.Web.MastodonAPI.ListView
+  alias Pleroma.Web.MastodonAPI.MastodonView
+  alias Pleroma.Web.MastodonAPI.PushSubscriptionView
+  alias Pleroma.Web.MastodonAPI.StatusView
+  alias Pleroma.Web.ActivityPub.ActivityPub
+  alias Pleroma.Web.ActivityPub.Utils
+  alias Pleroma.Web.OAuth.App
+  alias Pleroma.Web.OAuth.Authorization
+  alias Pleroma.Web.OAuth.Token
 
   import Ecto.Query
   require Logger
@@ -131,7 +139,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   @mastodon_api_level "2.5.0"
 
   def masto_instance(conn, _params) do
-    instance = Pleroma.Config.get(:instance)
+    instance = Config.get(:instance)
 
     response = %{
       uri: Web.base_url(),
@@ -227,7 +235,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       |> Map.put("user", user)
 
     activities =
-      ActivityPub.fetch_activities([user.ap_id | user.following], params)
+      [user.ap_id | user.following]
+      |> ActivityPub.fetch_activities(params)
       |> ActivityPub.contain_timeline(user)
       |> Enum.reverse()
 
@@ -240,14 +249,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   def public_timeline(%{assigns: %{user: user}} = conn, params) do
     local_only = params["local"] in [true, "True", "true", "1"]
 
-    params =
+    activities =
       params
       |> Map.put("type", ["Create", "Announce"])
       |> Map.put("local_only", local_only)
       |> Map.put("blocking_user", user)
-
-    activities =
-      ActivityPub.fetch_public_activities(params)
+      |> ActivityPub.fetch_public_activities()
       |> Enum.reverse()
 
     conn
@@ -316,6 +323,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
             as: :activity
           )
           |> Enum.reverse(),
+        # credo:disable-for-previous-line Credo.Check.Refactor.PipeChainStart
         descendants:
           StatusView.render(
             "index.json",
@@ -324,6 +332,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
             as: :activity
           )
           |> Enum.reverse()
+        # credo:disable-for-previous-line Credo.Check.Refactor.PipeChainStart
       }
 
       json(conn, result)
@@ -451,9 +460,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
     notifications = Notification.for_user(user, params)
 
     result =
-      Enum.map(notifications, fn x ->
-        render_notification(user, x)
-      end)
+      notifications
+      |> Enum.map(fn x -> render_notification(user, x) end)
       |> Enum.filter(& &1)
 
     conn
@@ -582,7 +590,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         []
         |> Enum.map(&String.downcase(&1))
 
-    query_params =
+    activities =
       params
       |> Map.put("type", "Create")
       |> Map.put("local_only", local_only)
@@ -590,9 +598,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       |> Map.put("tag", tags)
       |> Map.put("tag_all", tag_all)
       |> Map.put("tag_reject", tag_reject)
-
-    activities =
-      ActivityPub.fetch_public_activities(query_params)
+      |> ActivityPub.fetch_public_activities()
       |> Enum.reverse()
 
     conn
@@ -692,7 +698,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
          {:ok, _activity} <- ActivityPub.follow(follower, followed),
          {:ok, follower, followed} <-
            User.wait_and_refresh(
-             Pleroma.Config.get([:activitypub, :follow_handshake_timeout]),
+             Config.get([:activitypub, :follow_handshake_timeout]),
              follower,
              followed
            ) do
@@ -821,7 +827,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
     tags_path = Web.base_url() <> "/tag/"
 
     tags =
-      String.split(query)
+      query
+      |> String.split()
       |> Enum.uniq()
       |> Enum.filter(fn tag -> String.starts_with?(tag, "#") end)
       |> Enum.map(fn tag -> String.slice(tag, 1..-1) end)
@@ -843,7 +850,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
     statuses = status_search(user, query)
 
     tags =
-      String.split(query)
+      query
+      |> String.split()
       |> Enum.uniq()
       |> Enum.filter(fn tag -> String.starts_with?(tag, "#") end)
       |> Enum.map(fn tag -> String.slice(tag, 1..-1) end)
@@ -867,14 +875,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   end
 
   def favourites(%{assigns: %{user: user}} = conn, params) do
-    params =
+    activities =
       params
       |> Map.put("type", "Create")
       |> Map.put("favorited_by", user.ap_id)
       |> Map.put("blocking_user", user)
-
-    activities =
-      ActivityPub.fetch_public_activities(params)
+      |> ActivityPub.fetch_public_activities()
       |> Enum.reverse()
 
     conn
@@ -990,12 +996,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
 
       # we must filter the following list for the user to avoid leaking statuses the user
       # does not actually have permission to see (for more info, peruse security issue #270).
-      following_to =
+      activities =
         following
         |> Enum.filter(fn x -> x in user.following end)
-
-      activities =
-        ActivityPub.fetch_activities_bounded(following_to, following, params)
+        |> ActivityPub.fetch_activities_bounded(following, params)
         |> Enum.reverse()
 
       conn
@@ -1017,7 +1021,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
     if user && token do
       mastodon_emoji = mastodonized_emoji()
 
-      limit = Pleroma.Config.get([:instance, :limit])
+      limit = Config.get([:instance, :limit])
 
       accounts =
         Map.put(%{}, user.id, AccountView.render("account.json", %{user: user, for: user}))
@@ -1041,8 +1045,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
             max_toot_chars: limit
           },
           rights: %{
-            delete_others_notice: !!user.info.is_moderator,
-            admin: !!user.info.is_admin
+            delete_others_notice: present?(user.info.is_moderator),
+            admin: present?(user.info.is_admin)
           },
           compose: %{
             me: "#{user.id}",
@@ -1234,7 +1238,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   end
 
   def get_filters(%{assigns: %{user: user}} = conn, _) do
-    filters = Pleroma.Filter.get_filters(user)
+    filters = Filter.get_filters(user)
     res = FilterView.render("filters.json", filters: filters)
     json(conn, res)
   end
@@ -1243,7 +1247,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         %{assigns: %{user: user}} = conn,
         %{"phrase" => phrase, "context" => context} = params
       ) do
-    query = %Pleroma.Filter{
+    query = %Filter{
       user_id: user.id,
       phrase: phrase,
       context: context,
@@ -1252,13 +1256,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       # expires_at
     }
 
-    {:ok, response} = Pleroma.Filter.create(query)
+    {:ok, response} = Filter.create(query)
     res = FilterView.render("filter.json", filter: response)
     json(conn, res)
   end
 
   def get_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id}) do
-    filter = Pleroma.Filter.get(filter_id, user)
+    filter = Filter.get(filter_id, user)
     res = FilterView.render("filter.json", filter: filter)
     json(conn, res)
   end
@@ -1267,7 +1271,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         %{assigns: %{user: user}} = conn,
         %{"phrase" => phrase, "context" => context, "id" => filter_id} = params
       ) do
-    query = %Pleroma.Filter{
+    query = %Filter{
       user_id: user.id,
       filter_id: filter_id,
       phrase: phrase,
@@ -1277,32 +1281,32 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       # expires_at
     }
 
-    {:ok, response} = Pleroma.Filter.update(query)
+    {:ok, response} = Filter.update(query)
     res = FilterView.render("filter.json", filter: response)
     json(conn, res)
   end
 
   def delete_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id}) do
-    query = %Pleroma.Filter{
+    query = %Filter{
       user_id: user.id,
       filter_id: filter_id
     }
 
-    {:ok, _} = Pleroma.Filter.delete(query)
+    {:ok, _} = Filter.delete(query)
     json(conn, %{})
   end
 
   def create_push_subscription(%{assigns: %{user: user, token: token}} = conn, params) do
-    true = Pleroma.Web.Push.enabled()
-    Pleroma.Web.Push.Subscription.delete_if_exists(user, token)
-    {:ok, subscription} = Pleroma.Web.Push.Subscription.create(user, token, params)
+    true = Push.enabled()
+    Subscription.delete_if_exists(user, token)
+    {:ok, subscription} = Subscription.create(user, token, params)
     view = PushSubscriptionView.render("push_subscription.json", subscription: subscription)
     json(conn, view)
   end
 
   def get_push_subscription(%{assigns: %{user: user, token: token}} = conn, _params) do
-    true = Pleroma.Web.Push.enabled()
-    subscription = Pleroma.Web.Push.Subscription.get(user, token)
+    true = Push.enabled()
+    subscription = Subscription.get(user, token)
     view = PushSubscriptionView.render("push_subscription.json", subscription: subscription)
     json(conn, view)
   end
@@ -1311,15 +1315,15 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         %{assigns: %{user: user, token: token}} = conn,
         params
       ) do
-    true = Pleroma.Web.Push.enabled()
-    {:ok, subscription} = Pleroma.Web.Push.Subscription.update(user, token, params)
+    true = Push.enabled()
+    {:ok, subscription} = Subscription.update(user, token, params)
     view = PushSubscriptionView.render("push_subscription.json", subscription: subscription)
     json(conn, view)
   end
 
   def delete_push_subscription(%{assigns: %{user: user, token: token}} = conn, _params) do
-    true = Pleroma.Web.Push.enabled()
-    {:ok, _response} = Pleroma.Web.Push.Subscription.delete(user, token)
+    true = Push.enabled()
+    {:ok, _response} = Subscription.delete(user, token)
     json(conn, %{})
   end
 
@@ -1330,17 +1334,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   end
 
   def suggestions(%{assigns: %{user: user}} = conn, _) do
-    suggestions = Pleroma.Config.get(:suggestions)
+    suggestions = Config.get(:suggestions)
 
     if Keyword.get(suggestions, :enabled, false) do
       api = Keyword.get(suggestions, :third_party_engine, "")
       timeout = Keyword.get(suggestions, :timeout, 5000)
       limit = Keyword.get(suggestions, :limit, 23)
 
-      host = Pleroma.Config.get([Pleroma.Web.Endpoint, :url, :host])
+      host = Config.get([Pleroma.Web.Endpoint, :url, :host])
 
       user = user.nickname
-      url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user)
+
+      url =
+        api
+        |> String.replace("{{host}}", host)
+        |> String.replace("{{user}}", user)
 
       with {:ok, %{status: 200, body: body}} <-
              @httpoison.get(
@@ -1353,8 +1361,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
                ]
              ),
            {:ok, data} <- Jason.decode(body) do
-        data2 =
-          Enum.slice(data, 0, limit)
+        data =
+          data
+          |> Enum.slice(0, limit)
           |> Enum.map(fn x ->
             Map.put(
               x,
@@ -1373,7 +1382,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
           end)
 
         conn
-        |> json(data2)
+        |> json(data)
       else
         e -> Logger.error("Could not retrieve suggestions at fetch #{url}, #{inspect(e)}")
       end
@@ -1416,4 +1425,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
     |> put_status(501)
     |> json(%{error: "Can't display this activity"})
   end
+
+  defp present?(nil), do: false
+  defp present?(false), do: false
+  defp present?(_), do: true
 end
index 0ba4289da8cc75148abf9beede9a11d6f26bbf75..9df9f14b2a04ff352750e2d7f85a73a6224d09d3 100644 (file)
@@ -4,11 +4,12 @@
 
 defmodule Pleroma.Web.MastodonAPI.AccountView do
   use Pleroma.Web, :view
+
+  alias Pleroma.HTML
   alias Pleroma.User
-  alias Pleroma.Web.MastodonAPI.AccountView
   alias Pleroma.Web.CommonAPI.Utils
+  alias Pleroma.Web.MastodonAPI.AccountView
   alias Pleroma.Web.MediaProxy
-  alias Pleroma.HTML
 
   def render("accounts.json", %{users: users} = opts) do
     users
index 1052a449d291bd851b56e4ca20775489c9ddfb32..a685bc7b6091d086e5043da92810de6b7f0d5e90 100644 (file)
@@ -4,8 +4,8 @@
 
 defmodule Pleroma.Web.MastodonAPI.FilterView do
   use Pleroma.Web, :view
-  alias Pleroma.Web.MastodonAPI.FilterView
   alias Pleroma.Web.CommonAPI.Utils
+  alias Pleroma.Web.MastodonAPI.FilterView
 
   def render("filters.json", %{filters: filters} = opts) do
     render_many(filters, FilterView, "filter.json", opts)
index a227d742d8a162e86e5bc6c8d140ba4bbe58297f..f51a2ebb0e5ccd4d6039ce962886f1dfcf39da3b 100644 (file)
@@ -10,9 +10,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
   alias Pleroma.Repo
   alias Pleroma.User
   alias Pleroma.Web.CommonAPI.Utils
-  alias Pleroma.Web.MediaProxy
   alias Pleroma.Web.MastodonAPI.AccountView
   alias Pleroma.Web.MastodonAPI.StatusView
+  alias Pleroma.Web.MediaProxy
 
   # TODO: Add cached version.
   defp get_replied_to_activities(activities) do
index c0254c8e6471aa239b641ec0cb0f3863cf291764..ea75070c441f343e39b4e2c344d6fd869e722859 100644 (file)
@@ -6,7 +6,8 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
   require Logger
 
   alias Pleroma.Web.OAuth.Token
-  alias Pleroma.{User, Repo}
+  alias Pleroma.Repo
+  alias Pleroma.User
 
   @behaviour :cowboy_websocket_handler
 
index de79cad739b86c841d61b77c6439d3e866b96d5a..c0552d89f4bd98ea09d2ad047ba974c02f8b3846 100644 (file)
@@ -4,11 +4,12 @@
 
 defmodule Pleroma.Web.MediaProxy.MediaProxyController do
   use Pleroma.Web, :controller
-  alias Pleroma.{Web.MediaProxy, ReverseProxy}
+  alias Pleroma.ReverseProxy
+  alias Pleroma.Web.MediaProxy
 
   @default_proxy_opts [max_body_length: 25 * 1_048_576, http: [follow_redirect: true]]
 
-  def remote(conn, params = %{"sig" => sig64, "url" => url64}) do
+  def remote(conn, %{"sig" => sig64, "url" => url64} = params) do
     with config <- Pleroma.Config.get([:media_proxy], []),
          true <- Keyword.get(config, :enabled, false),
          {:ok, url} <- MediaProxy.decode_url(sig64, url64),
index e1eb1472d6f96b66f72efc71e5dd59c739e7f0c1..1e9da728373d1638f0d38dcd58f9e0d266137de8 100644 (file)
@@ -9,7 +9,7 @@ defmodule Pleroma.Web.MediaProxy do
 
   def url(""), do: nil
 
-  def url(url = "/" <> _), do: url
+  def url("/" <> _ = url), do: url
 
   def url(url) do
     config = Application.get_env(:pleroma, :media_proxy, [])
index 30333785ef05ec6b64c306526d96744ef9191909..190377767ddf4c534cecbcc4be0c2a9759ddfb20 100644 (file)
@@ -3,10 +3,12 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
-  alias Pleroma.Web.Metadata.Providers.Provider
+  alias Pleroma.HTML
+  alias Pleroma.Formatter
+  alias Pleroma.User
   alias Pleroma.Web.Metadata
-  alias Pleroma.{HTML, Formatter, User}
   alias Pleroma.Web.MediaProxy
+  alias Pleroma.Web.Metadata.Providers.Provider
 
   @behaviour Provider
 
index 8c7df5b90bf839cf9431d34363c1a68e81050a5e..f4867d05bd0c4de0e78d921be7eb06c1f2da8b5c 100644 (file)
@@ -5,10 +5,11 @@
 defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
   use Pleroma.Web, :controller
 
+  alias Pleroma.Config
+  alias Pleroma.Repo
   alias Pleroma.Stats
+  alias Pleroma.User
   alias Pleroma.Web
-  alias Pleroma.{User, Repo}
-  alias Pleroma.Config
   alias Pleroma.Web.ActivityPub.MRF
 
   plug(Pleroma.Web.FederatingPlug)
@@ -32,7 +33,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
 
   # returns a nodeinfo 2.0 map, since 2.1 just adds a repository field
   # under software.
-  def raw_nodeinfo() do
+  def raw_nodeinfo do
     instance = Application.get_env(:pleroma, :instance)
     media_proxy = Application.get_env(:pleroma, :media_proxy)
     suggestions = Application.get_env(:pleroma, :suggestions)
@@ -93,10 +94,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
       Config.get([:mrf_user_allowlist], [])
       |> Enum.into(%{}, fn {k, v} -> {k, length(v)} end)
 
-    mrf_transparency = Keyword.get(instance, :mrf_transparency)
-
     federation_response =
-      if mrf_transparency do
+      if Keyword.get(instance, :mrf_transparency) do
         %{
           mrf_policies: mrf_policies,
           mrf_simple: mrf_simple,
index 967ac04b5d378a366dc65372aae0d436d2b36e1f..3e8acde31cd0117e6c1622c98b41b7a1879b5a7b 100644 (file)
@@ -4,7 +4,7 @@
 
 defmodule Pleroma.Web.OAuth.App do
   use Ecto.Schema
-  import Ecto.{Changeset}
+  import Ecto.Changeset
 
   schema "apps" do
     field(:client_name, :string)
index f8c65602dda59cd682ed522f3e1abd8b8c951730..75c9ab9aa682793b9df17b32297ffd65a5e4475f 100644 (file)
@@ -5,10 +5,13 @@
 defmodule Pleroma.Web.OAuth.Authorization do
   use Ecto.Schema
 
-  alias Pleroma.{User, Repo}
-  alias Pleroma.Web.OAuth.{Authorization, App}
+  alias Pleroma.User
+  alias Pleroma.Repo
+  alias Pleroma.Web.OAuth.Authorization
+  alias Pleroma.Web.OAuth.App
 
-  import Ecto.{Changeset, Query}
+  import Ecto.Changeset
+  import Ecto.Query
 
   schema "oauth_authorizations" do
     field(:token, :string)
index 8ec963c79f557e2000e49e21ed1f8511dd3c891e..e4d0601f8ba00b7b8963cb10b73a83f0c18b8abf 100644 (file)
@@ -5,8 +5,11 @@
 defmodule Pleroma.Web.OAuth.OAuthController do
   use Pleroma.Web, :controller
 
-  alias Pleroma.Web.OAuth.{Authorization, Token, App}
-  alias Pleroma.{Repo, User}
+  alias Pleroma.Web.OAuth.Authorization
+  alias Pleroma.Web.OAuth.Token
+  alias Pleroma.Web.OAuth.App
+  alias Pleroma.Repo
+  alias Pleroma.User
   alias Comeonin.Pbkdf2
 
   plug(:fetch_session)
index 4e01b123b2ff3589f1b146a424c9ecd6d6624d71..b0bbeeb69d47fcc62fcdb43fe8d5f82dec1a68d6 100644 (file)
@@ -7,8 +7,11 @@ defmodule Pleroma.Web.OAuth.Token do
 
   import Ecto.Query
 
-  alias Pleroma.{User, Repo}
-  alias Pleroma.Web.OAuth.{Token, App, Authorization}
+  alias Pleroma.User
+  alias Pleroma.Repo
+  alias Pleroma.Web.OAuth.Token
+  alias Pleroma.Web.OAuth.App
+  alias Pleroma.Web.OAuth.Authorization
 
   schema "oauth_tokens" do
     field(:token, :string)
index 3d41fc708224649115daad4f1ffd670991a9fb86..9e1f24bc434fcb9ad7b3ae19c842851a45f37655 100644 (file)
@@ -3,8 +3,11 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.OStatus.ActivityRepresenter do
-  alias Pleroma.{Activity, User, Object}
+  alias Pleroma.Activity
+  alias Pleroma.User
+  alias Pleroma.Object
   alias Pleroma.Web.OStatus.UserRepresenter
+
   require Logger
 
   defp get_href(id) do
index 934d4042fb8c4ac1ffcdbcced2202dff1afc3b3b..025d4731cf0dc7067814310d7d39cc23096197c3 100644 (file)
@@ -3,10 +3,11 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.OStatus.FeedRepresenter do
-  alias Pleroma.Web.OStatus
-  alias Pleroma.Web.OStatus.{UserRepresenter, ActivityRepresenter}
   alias Pleroma.User
+  alias Pleroma.Web.OStatus
   alias Pleroma.Web.MediaProxy
+  alias Pleroma.Web.OStatus.ActivityRepresenter
+  alias Pleroma.Web.OStatus.UserRepresenter
 
   def to_simple_form(user, activities, _users) do
     most_recent_update =
index becdf2fbf18d36ebeb3cfb9beb3a4b5a1da5b63d..91ad4bc40f960c0ceb6e47a32b0b2ab8eee2b588 100644 (file)
@@ -3,7 +3,8 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.OStatus.FollowHandler do
-  alias Pleroma.Web.{XML, OStatus}
+  alias Pleroma.Web.XML
+  alias Pleroma.Web.OStatus
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.User
 
index c5b3e8d97af8f3ce61dc07be150a08100833ea89..c2e585cac18f7a72030661161a93df1f98202a60 100644 (file)
@@ -4,8 +4,10 @@
 
 defmodule Pleroma.Web.OStatus.NoteHandler do
   require Logger
-  alias Pleroma.Web.{XML, OStatus}
-  alias Pleroma.{Object, Activity}
+  alias Pleroma.Web.OStatus
+  alias Pleroma.Web.XML
+  alias Pleroma.Activity
+  alias Pleroma.Object
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.CommonAPI
index 1c64f3c3d2fce32e7dddcba0412506c604d926b0..c9085894d115cbb2e849452c3d4ff054324b0613 100644 (file)
@@ -3,7 +3,8 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.OStatus.UnfollowHandler do
-  alias Pleroma.Web.{XML, OStatus}
+  alias Pleroma.Web.XML
+  alias Pleroma.Web.OStatus
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.User
 
index a20ca17bbe7ce8498bdb3cf9faa3e3d158fd920d..b4f5761ac2d15f86c1645741117a749e149aebfc 100644 (file)
@@ -9,11 +9,19 @@ defmodule Pleroma.Web.OStatus do
   import Pleroma.Web.XML
   require Logger
 
-  alias Pleroma.{Repo, User, Web, Object, Activity}
+  alias Pleroma.Repo
+  alias Pleroma.User
+  alias Pleroma.Web
+  alias Pleroma.Object
+  alias Pleroma.Activity
   alias Pleroma.Web.ActivityPub.ActivityPub
-  alias Pleroma.Web.{WebFinger, Websub}
-  alias Pleroma.Web.OStatus.{FollowHandler, UnfollowHandler, NoteHandler, DeleteHandler}
   alias Pleroma.Web.ActivityPub.Transmogrifier
+  alias Pleroma.Web.WebFinger
+  alias Pleroma.Web.Websub
+  alias Pleroma.Web.OStatus.FollowHandler
+  alias Pleroma.Web.OStatus.UnfollowHandler
+  alias Pleroma.Web.OStatus.NoteHandler
+  alias Pleroma.Web.OStatus.DeleteHandler
 
   def is_representable?(%Activity{data: data}) do
     object = Object.normalize(data["object"])
index 302ff38a457716b06e557892c2315ce7aa1d6e0d..db4c8f4daf7d45c55656614379ffa196e7958778 100644 (file)
@@ -5,13 +5,17 @@
 defmodule Pleroma.Web.OStatus.OStatusController do
   use Pleroma.Web, :controller
 
-  alias Pleroma.{User, Activity, Object}
-  alias Pleroma.Web.OStatus.{FeedRepresenter, ActivityRepresenter}
-  alias Pleroma.Web.{OStatus, Federator}
-  alias Pleroma.Web.XML
-  alias Pleroma.Web.ActivityPub.ObjectView
-  alias Pleroma.Web.ActivityPub.ActivityPubController
+  alias Pleroma.Activity
+  alias Pleroma.Object
+  alias Pleroma.User
   alias Pleroma.Web.ActivityPub.ActivityPub
+  alias Pleroma.Web.ActivityPub.ActivityPubController
+  alias Pleroma.Web.ActivityPub.ObjectView
+  alias Pleroma.Web.OStatus.ActivityRepresenter
+  alias Pleroma.Web.OStatus.FeedRepresenter
+  alias Pleroma.Web.Federator
+  alias Pleroma.Web.OStatus
+  alias Pleroma.Web.XML
 
   plug(Pleroma.Web.FederatingPlug when action in [:salmon_incoming])
 
index ffd2aac91ad1097de63be3c229eb94a72f1e3028..ddd4fe0376fdf3a1584be21f6f5994c1a6b8066f 100644 (file)
@@ -5,7 +5,8 @@
 defmodule Pleroma.Web.Push do
   use GenServer
 
-  alias Pleroma.{Repo, User}
+  alias Pleroma.Repo
+  alias Pleroma.User
   alias Pleroma.Web.Push.Subscription
 
   require Logger
index bd9d9f3a75e2acc9844da61139cff9abf2f197ce..242e30910747cf32576b70080077ee1d24448cb4 100644 (file)
@@ -4,8 +4,11 @@
 
 defmodule Pleroma.Web.Push.Subscription do
   use Ecto.Schema
+
   import Ecto.Changeset
-  alias Pleroma.{Repo, User}
+
+  alias Pleroma.Repo
+  alias Pleroma.User
   alias Pleroma.Web.OAuth.Token
   alias Pleroma.Web.Push.Subscription
 
index 521fa7ee048cabcee0b465f524cae89170a56184..abb1cf7f2b481617fc18236328a397abf2032b65 100644 (file)
@@ -3,7 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.RichMedia.Helpers do
-  alias Pleroma.{Activity, Object, HTML}
+  alias Pleroma.Activity
+  alias Pleroma.Object
+  alias Pleroma.HTML
   alias Pleroma.Web.RichMedia.Parser
 
   def fetch_data_for_activity(%Activity{} = activity) do
index b1c2dc7fa96972cfc59de974098374cd5d1bd0df..a5a9e16c62cfd2f821234e960ce947f98d22ea19 100644 (file)
@@ -6,10 +6,12 @@ defmodule Pleroma.Web.Salmon do
   @httpoison Application.get_env(:pleroma, :httpoison)
 
   use Bitwise
+
   alias Pleroma.Instances
+  alias Pleroma.User
   alias Pleroma.Web.XML
   alias Pleroma.Web.OStatus.ActivityRepresenter
-  alias Pleroma.User
+
   require Logger
 
   def decode(salmon) do
index 978c77e57b4209c7248f91b2825a7f85c9b89ace..4de7608e4c683d789cbf80779101136739770c4d 100644 (file)
@@ -5,7 +5,11 @@
 defmodule Pleroma.Web.Streamer do
   use GenServer
   require Logger
-  alias Pleroma.{User, Notification, Activity, Object, Repo}
+  alias Pleroma.User
+  alias Pleroma.Notification
+  alias Pleroma.Activity
+  alias Pleroma.Object
+  alias Pleroma.Repo
   alias Pleroma.Web.ActivityPub.ActivityPub
 
   @keepalive_interval :timer.seconds(30)
index b347faa71e204ee5f48fb567c26516b29fe63228..e2fdedb25f94cab9182a44726697741943f1fc44 100644 (file)
@@ -4,14 +4,19 @@
 
 defmodule Pleroma.Web.TwitterAPI.UtilController do
   use Pleroma.Web, :controller
+
   require Logger
+
+  alias Comeonin.Pbkdf2
+  alias Pleroma.Emoji
+  alias Pleroma.PasswordResetToken
+  alias Pleroma.User
+  alias Pleroma.Repo
   alias Pleroma.Web
+  alias Pleroma.Web.CommonAPI
   alias Pleroma.Web.OStatus
   alias Pleroma.Web.WebFinger
-  alias Pleroma.Web.CommonAPI
-  alias Comeonin.Pbkdf2
   alias Pleroma.Web.ActivityPub.ActivityPub
-  alias Pleroma.{Repo, PasswordResetToken, User, Emoji}
 
   def show_password_reset(conn, %{"token" => token}) do
     with %{used: false} = token <- Repo.get_by(PasswordResetToken, %{token: token}),
index c4025cbd78c47e3597e1232f97f7d40b4f1f0acb..192ab7334a069c69350f21c7af9b004c98d87e84 100644 (file)
@@ -2,16 +2,20 @@
 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
+# FIXME: Remove this module?
 # THIS MODULE IS DEPRECATED! DON'T USE IT!
 # USE THE Pleroma.Web.TwitterAPI.Views.ActivityView MODULE!
 defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
   use Pleroma.Web.TwitterAPI.Representers.BaseRepresenter
   alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
-  alias Pleroma.{Activity, User}
-  alias Pleroma.Web.TwitterAPI.{TwitterAPI, UserView, ActivityView}
-  alias Pleroma.Web.CommonAPI.Utils
+  alias Pleroma.Activity
   alias Pleroma.Formatter
   alias Pleroma.HTML
+  alias Pleroma.User
+  alias Pleroma.Web.TwitterAPI.ActivityView
+  alias Pleroma.Web.TwitterAPI.TwitterAPI
+  alias Pleroma.Web.TwitterAPI.UserView
+  alias Pleroma.Web.CommonAPI.Utils
   alias Pleroma.Web.MastodonAPI.StatusView
 
   defp user_by_ap_id(user_list, ap_id) do
index ddd5c5cfbb1180a37fea74d16478fc2a13913529..162beb9be06b7ffb7f95b51efb434ed3d5d1871a 100644 (file)
@@ -3,8 +3,13 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
-  alias Pleroma.{UserInviteToken, User, Activity, Repo, Object}
-  alias Pleroma.{UserEmail, Mailer}
+  alias Pleroma.UserInviteToken
+  alias Pleroma.User
+  alias Pleroma.Activity
+  alias Pleroma.Repo
+  alias Pleroma.Object
+  alias Pleroma.UserEmail
+  alias Pleroma.Mailer
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.TwitterAPI.UserView
   alias Pleroma.Web.CommonAPI
index b781d981f180ca05891f3e08528a044b5f0aa6e3..c2f0dc2a9e331b361bb1820af6a79e743134f430 100644 (file)
@@ -7,12 +7,19 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
 
   import Pleroma.Web.ControllerHelper, only: [json_response: 3]
 
-  alias Pleroma.Web.TwitterAPI.{TwitterAPI, UserView, ActivityView, NotificationView}
-  alias Pleroma.Web.CommonAPI
-  alias Pleroma.{Repo, Activity, Object, User, Notification}
+  alias Ecto.Changeset
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Web.ActivityPub.Utils
-  alias Ecto.Changeset
+  alias Pleroma.Web.CommonAPI
+  alias Pleroma.Web.TwitterAPI.ActivityView
+  alias Pleroma.Web.TwitterAPI.NotificationView
+  alias Pleroma.Web.TwitterAPI.TwitterAPI
+  alias Pleroma.Web.TwitterAPI.UserView
+  alias Pleroma.Activity
+  alias Pleroma.Object
+  alias Pleroma.Notification
+  alias Pleroma.Repo
+  alias Pleroma.User
 
   require Logger
 
index d0d1221c347111d176107bd78de79b24281d1759..661022afa7f9464169c8d520d54fe6fa08d09355 100644 (file)
@@ -4,19 +4,18 @@
 
 defmodule Pleroma.Web.TwitterAPI.ActivityView do
   use Pleroma.Web, :view
-  alias Pleroma.Web.CommonAPI.Utils
-  alias Pleroma.User
-  alias Pleroma.Web.TwitterAPI.UserView
-  alias Pleroma.Web.TwitterAPI.ActivityView
-  alias Pleroma.Web.TwitterAPI.TwitterAPI
-  alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
-  alias Pleroma.Web.MastodonAPI.StatusView
   alias Pleroma.Activity
+  alias Pleroma.Formatter
   alias Pleroma.HTML
   alias Pleroma.Object
-  alias Pleroma.User
   alias Pleroma.Repo
-  alias Pleroma.Formatter
+  alias Pleroma.User
+  alias Pleroma.Web.CommonAPI.Utils
+  alias Pleroma.Web.MastodonAPI.StatusView
+  alias Pleroma.Web.TwitterAPI.ActivityView
+  alias Pleroma.Web.TwitterAPI.TwitterAPI
+  alias Pleroma.Web.TwitterAPI.UserView
+  alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
 
   import Ecto.Query
   require Logger
index d6a1c0a4d78e07a94446fed04744d6b8407944bb..e7c7a74964d06f832c30b9355aed88a12340edb3 100644 (file)
@@ -4,10 +4,11 @@
 
 defmodule Pleroma.Web.TwitterAPI.NotificationView do
   use Pleroma.Web, :view
-  alias Pleroma.{Notification, User}
+  alias Pleroma.Notification
+  alias Pleroma.User
   alias Pleroma.Web.CommonAPI.Utils
-  alias Pleroma.Web.TwitterAPI.UserView
   alias Pleroma.Web.TwitterAPI.ActivityView
+  alias Pleroma.Web.TwitterAPI.UserView
 
   defp get_user(ap_id, opts) do
     cond do
index cc53dfbc2b47e60223534475d653d89a18e09510..a09450df74629f63d92746aee30309cd1286712f 100644 (file)
@@ -4,11 +4,11 @@
 
 defmodule Pleroma.Web.TwitterAPI.UserView do
   use Pleroma.Web, :view
-  alias Pleroma.User
   alias Pleroma.Formatter
+  alias Pleroma.HTML
+  alias Pleroma.User
   alias Pleroma.Web.CommonAPI.Utils
   alias Pleroma.Web.MediaProxy
-  alias Pleroma.HTML
 
   def render("show.json", %{user: user = %User{}} = assigns) do
     render_one(user, Pleroma.Web.TwitterAPI.UserView, "user.json", assigns)
index 6c28d1197b1c22188b117f7007e790c4c066a9d3..5d8a77346fb6d3f299d8300206f2061fe61840c6 100644 (file)
@@ -3,7 +3,7 @@ defmodule Pleroma.Web.UploaderController do
 
   alias Pleroma.Uploaders.Uploader
 
-  def callback(conn, params = %{"upload_path" => upload_path}) do
+  def callback(conn, %{"upload_path" => upload_path} = params) do
     process_callback(conn, :global.whereis_name({Uploader, upload_path}), params)
   end
 
index 30558e6926ad601355372e544e688e629a28b682..853aa2a87f8d63febb13036e11f00477fbef7f1a 100644 (file)
@@ -24,7 +24,8 @@ defmodule Pleroma.Web do
     quote do
       use Phoenix.Controller, namespace: Pleroma.Web
       import Plug.Conn
-      import Pleroma.Web.{Gettext, Router.Helpers}
+      import Pleroma.Web.Gettext
+      import Pleroma.Web.Router.Helpers
     end
   end
 
@@ -37,7 +38,9 @@ defmodule Pleroma.Web do
       # Import convenience functions from controllers
       import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1]
 
-      import Pleroma.Web.{ErrorHelpers, Gettext, Router.Helpers}
+      import Pleroma.Web.ErrorHelpers
+      import Pleroma.Web.Gettext
+      import Pleroma.Web.Router.Helpers
 
       require Logger
 
@@ -71,6 +74,7 @@ defmodule Pleroma.Web do
   def router do
     quote do
       use Phoenix.Router
+      # credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
       import Plug.Conn
       import Phoenix.Controller
     end
@@ -78,6 +82,7 @@ defmodule Pleroma.Web do
 
   def channel do
     quote do
+      # credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
       use Phoenix.Channel
       import Pleroma.Web.Gettext
     end
index 0a63383121c43f8239da443fc4801c2d6da565e1..5ea5ae48e809fe21b3770b05c5e7f1a389d552fe 100644 (file)
@@ -5,9 +5,12 @@
 defmodule Pleroma.Web.WebFinger do
   @httpoison Application.get_env(:pleroma, :httpoison)
 
-  alias Pleroma.{User, XmlBuilder}
+  alias Pleroma.User
+  alias Pleroma.XmlBuilder
   alias Pleroma.Web
-  alias Pleroma.Web.{XML, Salmon, OStatus}
+  alias Pleroma.Web.XML
+  alias Pleroma.Web.Salmon
+  alias Pleroma.Web.OStatus
   require Jason
   require Logger
 
index 90ba79962718ef0f6550f5cc3b380c094a276d26..a08d7993d007915d63a00265ab4389ab2e825a37 100644 (file)
@@ -4,11 +4,14 @@
 
 defmodule Pleroma.Web.Websub do
   alias Ecto.Changeset
-  alias Pleroma.Repo
   alias Pleroma.Instances
-  alias Pleroma.Web.Websub.{WebsubServerSubscription, WebsubClientSubscription}
+  alias Pleroma.Repo
+  alias Pleroma.Web.Websub.WebsubServerSubscription
+  alias Pleroma.Web.Websub.WebsubClientSubscription
   alias Pleroma.Web.OStatus.FeedRepresenter
-  alias Pleroma.Web.{XML, Endpoint, OStatus}
+  alias Pleroma.Web.XML
+  alias Pleroma.Web.Endpoint
+  alias Pleroma.Web.OStatus
   alias Pleroma.Web.Router.Helpers
   require Logger
 
index a92dfe87b6cd0191bc412d10e1f960f9a05adc6d..1ad18a8a4edad84fae8252a4ca5b266b6a62096e 100644 (file)
@@ -5,8 +5,10 @@
 defmodule Pleroma.Web.Websub.WebsubController do
   use Pleroma.Web, :controller
 
-  alias Pleroma.{Repo, User}
-  alias Pleroma.Web.{Websub, Federator}
+  alias Pleroma.Repo
+  alias Pleroma.User
+  alias Pleroma.Web.Websub
+  alias Pleroma.Web.Federator
   alias Pleroma.Web.Websub.WebsubClientSubscription
 
   require Logger