From a951f219bcf63bbdb5b9048a018d497fdc63a62f Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 16 Dec 2020 20:41:35 +0100 Subject: Linting --- lib/pleroma/config.ex | 5 ----- lib/pleroma/config/getting.ex | 8 ++++++++ lib/pleroma/web/activity_pub/activity_pub.ex | 4 ---- lib/pleroma/web/activity_pub/activity_pub/persisting.ex | 7 +++++++ lib/pleroma/web/activity_pub/mrf.ex | 4 ---- lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex | 7 +++++++ lib/pleroma/web/activity_pub/object_validator.ex | 4 ---- lib/pleroma/web/activity_pub/object_validator/validating.ex | 7 +++++++ lib/pleroma/web/activity_pub/side_effects.ex | 5 ----- lib/pleroma/web/activity_pub/side_effects/handling.ex | 8 ++++++++ lib/pleroma/web/federator.ex | 4 ---- lib/pleroma/web/federator/publishing.ex | 7 +++++++ test/pleroma/web/activity_pub/pipeline_test.exs | 2 +- 13 files changed, 45 insertions(+), 27 deletions(-) create mode 100644 lib/pleroma/config/getting.ex create mode 100644 lib/pleroma/web/activity_pub/activity_pub/persisting.ex create mode 100644 lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex create mode 100644 lib/pleroma/web/activity_pub/object_validator/validating.ex create mode 100644 lib/pleroma/web/activity_pub/side_effects/handling.ex create mode 100644 lib/pleroma/web/federator/publishing.ex diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index 1ee4777f6..86d4f6b72 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -2,11 +2,6 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Config.Getting do - @callback get(any()) :: any() - @callback get(any(), any()) :: any() -end - defmodule Pleroma.Config do @behaviour Pleroma.Config.Getting defmodule Error do diff --git a/lib/pleroma/config/getting.ex b/lib/pleroma/config/getting.ex new file mode 100644 index 000000000..cc557674c --- /dev/null +++ b/lib/pleroma/config/getting.ex @@ -0,0 +1,8 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Config.Getting do + @callback get(any()) :: any() + @callback get(any(), any()) :: any() +end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 0f839af10..5059bff03 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -2,10 +2,6 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.ActivityPub.Persisting do - @callback persist(map(), keyword()) :: {:ok, Activity.t() | Object.t()} -end - defmodule Pleroma.Web.ActivityPub.ActivityPub do alias Pleroma.Activity alias Pleroma.Activity.Ir.Topics diff --git a/lib/pleroma/web/activity_pub/activity_pub/persisting.ex b/lib/pleroma/web/activity_pub/activity_pub/persisting.ex new file mode 100644 index 000000000..3894f48e2 --- /dev/null +++ b/lib/pleroma/web/activity_pub/activity_pub/persisting.ex @@ -0,0 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.ActivityPub.Persisting do + @callback persist(map(), keyword()) :: {:ok, Activity.t() | Object.t()} +end diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index 3de21b219..02fdee5fc 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -2,10 +2,6 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.MRF.PipelineFiltering do - @callback pipeline_filter(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()} -end - defmodule Pleroma.Web.ActivityPub.MRF do require Logger diff --git a/lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex b/lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex new file mode 100644 index 000000000..8e0069bc5 --- /dev/null +++ b/lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex @@ -0,0 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.PipelineFiltering do + @callback pipeline_filter(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()} +end diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index a731c5a1c..ce8e7341b 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -2,10 +2,6 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.ObjectValidator.Validating do - @callback validate(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()} -end - defmodule Pleroma.Web.ActivityPub.ObjectValidator do @moduledoc """ This module is responsible for validating an object (which can be an activity) diff --git a/lib/pleroma/web/activity_pub/object_validator/validating.ex b/lib/pleroma/web/activity_pub/object_validator/validating.ex new file mode 100644 index 000000000..64c0c30c5 --- /dev/null +++ b/lib/pleroma/web/activity_pub/object_validator/validating.ex @@ -0,0 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.ObjectValidator.Validating do + @callback validate(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()} +end diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index dee0396f5..da6c2a94b 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -2,11 +2,6 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.SideEffects.Handling do - @callback handle(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()} - @callback handle_after_transaction(map()) :: map() -end - defmodule Pleroma.Web.ActivityPub.SideEffects do @moduledoc """ This module looks at an inserted object and executes the side effects that it diff --git a/lib/pleroma/web/activity_pub/side_effects/handling.ex b/lib/pleroma/web/activity_pub/side_effects/handling.ex new file mode 100644 index 000000000..9d64c0e47 --- /dev/null +++ b/lib/pleroma/web/activity_pub/side_effects/handling.ex @@ -0,0 +1,8 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.SideEffects.Handling do + @callback handle(map(), keyword()) :: {:ok, map(), keyword()} | {:error, any()} + @callback handle_after_transaction(map()) :: map() +end diff --git a/lib/pleroma/web/federator.ex b/lib/pleroma/web/federator.ex index 186861fd9..658d20954 100644 --- a/lib/pleroma/web/federator.ex +++ b/lib/pleroma/web/federator.ex @@ -2,10 +2,6 @@ # Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.Federator.Publishing do - @callback publish(map()) :: any() -end - defmodule Pleroma.Web.Federator do alias Pleroma.Activity alias Pleroma.Object.Containment diff --git a/lib/pleroma/web/federator/publishing.ex b/lib/pleroma/web/federator/publishing.ex new file mode 100644 index 000000000..d6fba8f24 --- /dev/null +++ b/lib/pleroma/web/federator/publishing.ex @@ -0,0 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.Federator.Publishing do + @callback publish(map()) :: any() +end diff --git a/test/pleroma/web/activity_pub/pipeline_test.exs b/test/pleroma/web/activity_pub/pipeline_test.exs index d0e3fb347..d568d825b 100644 --- a/test/pleroma/web/activity_pub/pipeline_test.exs +++ b/test/pleroma/web/activity_pub/pipeline_test.exs @@ -8,12 +8,12 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do import Mox import Pleroma.Factory + alias Pleroma.ConfigMock alias Pleroma.Web.ActivityPub.ActivityPubMock alias Pleroma.Web.ActivityPub.MRFMock alias Pleroma.Web.ActivityPub.ObjectValidatorMock alias Pleroma.Web.ActivityPub.SideEffectsMock alias Pleroma.Web.FederatorMock - alias Pleroma.ConfigMock setup :verify_on_exit! -- cgit v1.2.3