From: Haelwenn (lanodan) Monnier Date: Wed, 6 Feb 2019 19:20:02 +0000 (+0100) Subject: Credo fixes: alias grouping/ordering X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=60ea29dfe64c9b3c4e7b7bfa8aef0dfed4d37f3f;p=akkoma Credo fixes: alias grouping/ordering --- diff --git a/lib/pleroma/captcha/captcha.ex b/lib/pleroma/captcha/captcha.ex index 0207bcbea..f70f5a191 100644 --- a/lib/pleroma/captcha/captcha.ex +++ b/lib/pleroma/captcha/captcha.ex @@ -3,8 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Captcha do - alias Plug.Crypto.KeyGenerator - alias Plug.Crypto.MessageEncryptor + alias Plug.Crypto.{KeyGenerator, MessageEncryptor} alias Calendar.DateTime use GenServer diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 386096a52..8a8af266c 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -3,10 +3,8 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Formatter do - alias Pleroma.User + alias Pleroma.{Emoji, HTML, User} alias Pleroma.Web.MediaProxy - alias Pleroma.HTML - alias Pleroma.Emoji @tag_regex ~r/((?<=[^&])|\A)(\#)(\w+)/u @markdown_characters_regex ~r/(`|\*|_|{|}|[|]|\(|\)|#|\+|-|\.|!)/ diff --git a/lib/pleroma/gopher/server.ex b/lib/pleroma/gopher/server.ex index b47a0697d..a284b3c61 100644 --- a/lib/pleroma/gopher/server.ex +++ b/lib/pleroma/gopher/server.ex @@ -37,10 +37,7 @@ 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.{Activity, HTML, User, Repo} def start_link(ref, socket, transport, opts) do pid = spawn_link(__MODULE__, :init, [ref, socket, transport, opts]) diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex index b4a4742ee..0fd41ffb8 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -125,6 +125,7 @@ defmodule Pleroma.HTML.Scrubber.Default do @doc "The default HTML scrubbing policy: no " require HtmlSanitizeEx.Scrubber.Meta + alias HtmlSanitizeEx.Scrubber.Meta @markup Application.get_env(:pleroma, :markup) diff --git a/lib/pleroma/instances/instance.ex b/lib/pleroma/instances/instance.ex index 4a4ca26dd..bab8e0564 100644 --- a/lib/pleroma/instances/instance.ex +++ b/lib/pleroma/instances/instance.ex @@ -1,15 +1,13 @@ defmodule Pleroma.Instances.Instance do @moduledoc "Instance." - alias Pleroma.Instances + alias Pleroma.{Instances, Repo} alias Pleroma.Instances.Instance use Ecto.Schema import Ecto.{Query, Changeset} - alias Pleroma.Repo - schema "instances" do field(:host, :string) field(:unreachable_since, :naive_datetime) diff --git a/lib/pleroma/plugs/user_fetcher_plug.ex b/lib/pleroma/plugs/user_fetcher_plug.ex index f874e2f95..6d6ab0926 100644 --- a/lib/pleroma/plugs/user_fetcher_plug.ex +++ b/lib/pleroma/plugs/user_fetcher_plug.ex @@ -3,9 +3,9 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Plugs.UserFetcherPlug do + alias Pleroma.{User, Repo} + import Plug.Conn - alias Pleroma.Repo - alias Pleroma.User def init(options) do options diff --git a/lib/pleroma/user_invite_token.ex b/lib/pleroma/user_invite_token.ex index 5a448114c..8e449444c 100644 --- a/lib/pleroma/user_invite_token.ex +++ b/lib/pleroma/user_invite_token.ex @@ -7,8 +7,7 @@ defmodule Pleroma.UserInviteToken do import Ecto.Changeset - alias Pleroma.UserInviteToken - alias Pleroma.Repo + alias Pleroma.{UserInviteToken, Repo} schema "user_invite_tokens" do field(:token, :string) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index e1cd2d34c..6028e96a9 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -5,11 +5,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do alias Pleroma.{Activity, Repo, Object, Upload, User, Notification, Instances} alias Pleroma.Web.ActivityPub.{Transmogrifier, MRF} - alias Pleroma.Web.WebFinger - alias Pleroma.Web.Federator - alias Pleroma.Web.OStatus + alias Pleroma.Web.{WebFinger, Federator, OStatus} + import Ecto.Query import Pleroma.Web.ActivityPub.Utils + require Logger @httpoison Application.get_env(:pleroma, :httpoison) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 2cdf132e2..01b521051 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -7,10 +7,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do alias Pleroma.{Activity, User, Object} alias Pleroma.Web.ActivityPub.{ObjectView, 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.{ActivityPub, Relay, Transmogrifier, Utils} alias Pleroma.Web.Federator require Logger diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 7151efdeb..edfbc9bb2 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -6,12 +6,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do @moduledoc """ A module to handle coding from internal to wire ActivityPub and back. """ - alias Pleroma.User - alias Pleroma.Object - alias Pleroma.Activity - alias Pleroma.Repo - alias Pleroma.Web.ActivityPub.ActivityPub - alias Pleroma.Web.ActivityPub.Utils + alias Pleroma.{Activity, User, Object, Repo} + alias Pleroma.Web.ActivityPub.{ActivityPub, Utils} import Ecto.Query diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index 43ec2010d..ba3aea1a6 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -4,13 +4,11 @@ defmodule Pleroma.Web.ActivityPub.UserView do use Pleroma.Web, :view - alias Pleroma.Web.Salmon - alias Pleroma.Web.WebFinger - alias Pleroma.User - alias Pleroma.Repo - alias Pleroma.Web.ActivityPub.ActivityPub - alias Pleroma.Web.ActivityPub.Transmogrifier - alias Pleroma.Web.ActivityPub.Utils + + alias Pleroma.Web.{WebFinger, Salmon} + alias Pleroma.{User, Repo} + alias Pleroma.Web.ActivityPub.{ActivityPub, Transmogrifier, Utils} + import Ecto.Query # the instance itself is not a Person, but instead an Application diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 7084da6de..4388396cf 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -4,8 +4,7 @@ defmodule Pleroma.Web.CommonAPI do alias Pleroma.{User, Repo, Activity, Object} - alias Pleroma.Web.ActivityPub.ActivityPub - alias Pleroma.Web.ActivityPub.Utils + alias Pleroma.Web.ActivityPub.{ActivityPub, Utils} alias Pleroma.Formatter import Pleroma.Web.CommonAPI.Utils diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index be90b60bc..e50d63d77 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -7,9 +7,8 @@ defmodule Pleroma.Web.CommonAPI.Utils do alias Comeonin.Pbkdf2 alias Pleroma.{Activity, Formatter, Object, Repo} alias Pleroma.{User, Web} + alias Pleroma.Web.{Endpoint, MediaProxy} alias Pleroma.Web.ActivityPub.Utils - alias Pleroma.Web.Endpoint - alias Pleroma.Web.MediaProxy # This is a hack for twidere. def get_by_id_or_ap_id(id) do diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index 6fe3dd2a0..71648e8c7 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -4,15 +4,13 @@ defmodule Pleroma.Web.Federator do use GenServer - alias Pleroma.User - alias Pleroma.Activity + + alias Pleroma.{Activity, User} alias Pleroma.Web.{WebFinger, Websub, Salmon} + alias Pleroma.Web.ActivityPub.{ActivityPub, Relay, Transmogrifier, Utils} alias Pleroma.Web.Federator.RetryQueue - alias Pleroma.Web.ActivityPub.ActivityPub - alias Pleroma.Web.ActivityPub.Relay - alias Pleroma.Web.ActivityPub.Transmogrifier - alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.OStatus + require Logger @websub Application.get_env(:pleroma, :websub) diff --git a/lib/pleroma/web/http_signatures/http_signatures.ex b/lib/pleroma/web/http_signatures/http_signatures.ex index e81f9e27a..5ff93663e 100644 --- a/lib/pleroma/web/http_signatures/http_signatures.ex +++ b/lib/pleroma/web/http_signatures/http_signatures.ex @@ -5,8 +5,8 @@ # 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.{ActivityPub, Utils} + require Logger def split_signature(sig) do diff --git a/lib/pleroma/web/metadata/opengraph.ex b/lib/pleroma/web/metadata/opengraph.ex index 30333785e..479c9d20d 100644 --- a/lib/pleroma/web/metadata/opengraph.ex +++ b/lib/pleroma/web/metadata/opengraph.ex @@ -3,10 +3,9 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.OpenGraph do - alias Pleroma.Web.Metadata.Providers.Provider - alias Pleroma.Web.Metadata alias Pleroma.{HTML, Formatter, User} - alias Pleroma.Web.MediaProxy + alias Pleroma.Web.{Metadata, MediaProxy} + alias Pleroma.Web.Metadata.Providers.Provider @behaviour Provider diff --git a/lib/pleroma/web/ostatus/feed_representer.ex b/lib/pleroma/web/ostatus/feed_representer.ex index 934d4042f..fd530307c 100644 --- a/lib/pleroma/web/ostatus/feed_representer.ex +++ b/lib/pleroma/web/ostatus/feed_representer.ex @@ -3,10 +3,9 @@ # 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.MediaProxy + alias Pleroma.Web.{OStatus, MediaProxy} + alias Pleroma.Web.OStatus.{UserRepresenter, ActivityRepresenter} def to_simple_form(user, activities, _users) do most_recent_update = diff --git a/lib/pleroma/web/ostatus/handlers/note_handler.ex b/lib/pleroma/web/ostatus/handlers/note_handler.ex index c5b3e8d97..5bbb86f87 100644 --- a/lib/pleroma/web/ostatus/handlers/note_handler.ex +++ b/lib/pleroma/web/ostatus/handlers/note_handler.ex @@ -6,8 +6,7 @@ defmodule Pleroma.Web.OStatus.NoteHandler do require Logger alias Pleroma.Web.{XML, OStatus} alias Pleroma.{Object, Activity} - alias Pleroma.Web.ActivityPub.ActivityPub - alias Pleroma.Web.ActivityPub.Utils + alias Pleroma.Web.ActivityPub.{ActivityPub, Utils} alias Pleroma.Web.CommonAPI @doc """ diff --git a/lib/pleroma/web/ostatus/ostatus.ex b/lib/pleroma/web/ostatus/ostatus.ex index a20ca17bb..e1213923e 100644 --- a/lib/pleroma/web/ostatus/ostatus.ex +++ b/lib/pleroma/web/ostatus/ostatus.ex @@ -10,10 +10,9 @@ defmodule Pleroma.Web.OStatus do require Logger alias Pleroma.{Repo, User, Web, Object, Activity} - alias Pleroma.Web.ActivityPub.ActivityPub + alias Pleroma.Web.ActivityPub.{ActivityPub, Transmogrifier} alias Pleroma.Web.{WebFinger, Websub} alias Pleroma.Web.OStatus.{FollowHandler, UnfollowHandler, NoteHandler, DeleteHandler} - alias Pleroma.Web.ActivityPub.Transmogrifier def is_representable?(%Activity{data: data}) do object = Object.normalize(data["object"]) diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex index 302ff38a4..ed0df620b 100644 --- a/lib/pleroma/web/ostatus/ostatus_controller.ex +++ b/lib/pleroma/web/ostatus/ostatus_controller.ex @@ -5,13 +5,11 @@ 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.{Activity, Object, User} + alias Pleroma.Web.ActivityPub.{ActivityPub, ActivityPubController, ObjectView} + alias Pleroma.Web.OStatus.{ActivityRepresenter, FeedRepresenter} + alias Pleroma.Web.{Federator, OStatus} alias Pleroma.Web.XML - alias Pleroma.Web.ActivityPub.ObjectView - alias Pleroma.Web.ActivityPub.ActivityPubController - alias Pleroma.Web.ActivityPub.ActivityPub plug(Pleroma.Web.FederatingPlug when action in [:salmon_incoming]) diff --git a/lib/pleroma/web/salmon/salmon.ex b/lib/pleroma/web/salmon/salmon.ex index b1c2dc7fa..fb08d645b 100644 --- a/lib/pleroma/web/salmon/salmon.ex +++ b/lib/pleroma/web/salmon/salmon.ex @@ -6,10 +6,11 @@ defmodule Pleroma.Web.Salmon do @httpoison Application.get_env(:pleroma, :httpoison) use Bitwise - alias Pleroma.Instances + + alias Pleroma.{Instances, User} alias Pleroma.Web.XML alias Pleroma.Web.OStatus.ActivityRepresenter - alias Pleroma.User + require Logger def decode(salmon) do diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index b347faa71..bf8d7e5aa 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -4,14 +4,14 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do use Pleroma.Web, :controller + require Logger - alias Pleroma.Web - alias Pleroma.Web.OStatus - alias Pleroma.Web.WebFinger - alias Pleroma.Web.CommonAPI + alias Comeonin.Pbkdf2 + alias Pleroma.{Emoji, PasswordResetToken, User, Repo} + alias Pleroma.Web + alias Pleroma.Web.{CommonAPI, OStatus, WebFinger} 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}), diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex index c4025cbd7..a5fec88f7 100644 --- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex @@ -7,11 +7,9 @@ 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.{Activity, Formatter, HTML, User} + alias Pleroma.Web.TwitterAPI.{ActivityView, TwitterAPI, UserView} alias Pleroma.Web.CommonAPI.Utils - alias Pleroma.Formatter - alias Pleroma.HTML alias Pleroma.Web.MastodonAPI.StatusView defp user_by_ap_id(user_list, ap_id) do diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index b781d981f..c0081bf6e 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -7,12 +7,11 @@ 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 Pleroma.Web.ActivityPub.ActivityPub - alias Pleroma.Web.ActivityPub.Utils alias Ecto.Changeset + alias Pleroma.Web.ActivityPub.{ActivityPub, Utils} + alias Pleroma.Web.CommonAPI + alias Pleroma.Web.TwitterAPI.{ActivityView, NotificationView, TwitterAPI, UserView} + alias Pleroma.{Activity, Object, Notification, Repo, User} require Logger diff --git a/lib/pleroma/web/twitter_api/views/activity_view.ex b/lib/pleroma/web/twitter_api/views/activity_view.ex index d0d1221c3..dbcb732fe 100644 --- a/lib/pleroma/web/twitter_api/views/activity_view.ex +++ b/lib/pleroma/web/twitter_api/views/activity_view.ex @@ -4,19 +4,11 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do use Pleroma.Web, :view + alias Pleroma.{Activity, Formatter, HTML, Object, Repo, User} 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.HTML - alias Pleroma.Object - alias Pleroma.User - alias Pleroma.Repo - alias Pleroma.Formatter + alias Pleroma.Web.TwitterAPI.{ActivityView, TwitterAPI, UserView} + alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter import Ecto.Query require Logger diff --git a/lib/pleroma/web/twitter_api/views/notification_view.ex b/lib/pleroma/web/twitter_api/views/notification_view.ex index d6a1c0a4d..414ed4731 100644 --- a/lib/pleroma/web/twitter_api/views/notification_view.ex +++ b/lib/pleroma/web/twitter_api/views/notification_view.ex @@ -6,8 +6,7 @@ defmodule Pleroma.Web.TwitterAPI.NotificationView do use Pleroma.Web, :view alias Pleroma.{Notification, User} alias Pleroma.Web.CommonAPI.Utils - alias Pleroma.Web.TwitterAPI.UserView - alias Pleroma.Web.TwitterAPI.ActivityView + alias Pleroma.Web.TwitterAPI.{ActivityView, UserView} defp get_user(ap_id, opts) do cond do diff --git a/lib/pleroma/web/twitter_api/views/user_view.ex b/lib/pleroma/web/twitter_api/views/user_view.ex index cc53dfbc2..3cde3bc1b 100644 --- a/lib/pleroma/web/twitter_api/views/user_view.ex +++ b/lib/pleroma/web/twitter_api/views/user_view.ex @@ -4,11 +4,9 @@ defmodule Pleroma.Web.TwitterAPI.UserView do use Pleroma.Web, :view - alias Pleroma.User - alias Pleroma.Formatter + alias Pleroma.{Formatter, HTML, 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) diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex index 90ba79962..de6508f52 100644 --- a/lib/pleroma/web/websub/websub.ex +++ b/lib/pleroma/web/websub/websub.ex @@ -4,8 +4,7 @@ defmodule Pleroma.Web.Websub do alias Ecto.Changeset - alias Pleroma.Repo - alias Pleroma.Instances + alias Pleroma.{Instances, Repo} alias Pleroma.Web.Websub.{WebsubServerSubscription, WebsubClientSubscription} alias Pleroma.Web.OStatus.FeedRepresenter alias Pleroma.Web.{XML, Endpoint, OStatus}