commit: 5ce612b2723381a978f3810a414a3c3038a1859c
parent 4c8a8a4b62151ab86019cf92ffb67dc81e13cdd7
Author: Lain Soykaf <lain@lain.com>
Date: Tue, 11 Mar 2025 18:21:27 +0400
Linting
Diffstat:
10 files changed, 51 insertions(+), 48 deletions(-)
diff --git a/lib/pleroma/datetime.ex b/lib/pleroma/date_time.ex
diff --git a/lib/pleroma/datetime/impl.ex b/lib/pleroma/date_time/impl.ex
diff --git a/lib/pleroma/mogrify.ex b/lib/pleroma/mogrify.ex
@@ -1,42 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.MogrifyBehaviour do
- @moduledoc """
- Behaviour for Mogrify operations.
- This module defines the interface for Mogrify operations that can be mocked in tests.
- """
-
- @callback open(binary()) :: map()
- @callback custom(map(), binary()) :: map()
- @callback custom(map(), binary(), binary()) :: map()
- @callback save(map(), keyword()) :: map()
-end
-
-defmodule Pleroma.MogrifyWrapper do
- @moduledoc """
- Default implementation of MogrifyBehaviour that delegates to Mogrify.
- """
- @behaviour Pleroma.MogrifyBehaviour
-
- @impl true
- def open(file) do
- Mogrify.open(file)
- end
-
- @impl true
- def custom(image, action) do
- Mogrify.custom(image, action)
- end
-
- @impl true
- def custom(image, action, options) do
- Mogrify.custom(image, action, options)
- end
-
- @impl true
- def save(image, opts) do
- Mogrify.save(image, opts)
- end
-end
diff --git a/lib/pleroma/mogrify_behaviour.ex b/lib/pleroma/mogrify_behaviour.ex
@@ -0,0 +1,15 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.MogrifyBehaviour do
+ @moduledoc """
+ Behaviour for Mogrify operations.
+ This module defines the interface for Mogrify operations that can be mocked in tests.
+ """
+
+ @callback open(binary()) :: map()
+ @callback custom(map(), binary()) :: map()
+ @callback custom(map(), binary(), binary()) :: map()
+ @callback save(map(), keyword()) :: map()
+end
diff --git a/lib/pleroma/mogrify_wrapper.ex b/lib/pleroma/mogrify_wrapper.ex
@@ -0,0 +1,30 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.MogrifyWrapper do
+ @moduledoc """
+ Default implementation of MogrifyBehaviour that delegates to Mogrify.
+ """
+ @behaviour Pleroma.MogrifyBehaviour
+
+ @impl true
+ def open(file) do
+ Mogrify.open(file)
+ end
+
+ @impl true
+ def custom(image, action) do
+ Mogrify.custom(image, action)
+ end
+
+ @impl true
+ def custom(image, action, options) do
+ Mogrify.custom(image, action, options)
+ end
+
+ @impl true
+ def save(image, opts) do
+ Mogrify.save(image, opts)
+ end
+end
diff --git a/test/pleroma/upload/filter/anonymize_filename_test.exs b/test/pleroma/upload/filter/anonymize_filename_test.exs
@@ -6,8 +6,8 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do
use Pleroma.DataCase, async: true
import Mox
- alias Pleroma.Upload
alias Pleroma.StaticStubbedConfigMock, as: ConfigMock
+ alias Pleroma.Upload
setup do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
diff --git a/test/pleroma/upload/filter/mogrifun_test.exs b/test/pleroma/upload/filter/mogrifun_test.exs
@@ -6,9 +6,9 @@ defmodule Pleroma.Upload.Filter.MogrifunTest do
use Pleroma.DataCase, async: true
import Mox
+ alias Pleroma.MogrifyMock
alias Pleroma.Upload
alias Pleroma.Upload.Filter
- alias Pleroma.MogrifyMock
test "apply mogrify filter" do
File.cp!(
diff --git a/test/pleroma/upload/filter/mogrify_test.exs b/test/pleroma/upload/filter/mogrify_test.exs
@@ -6,9 +6,9 @@ defmodule Pleroma.Upload.Filter.MogrifyTest do
use Pleroma.DataCase, async: true
import Mox
- alias Pleroma.Upload.Filter
- alias Pleroma.StaticStubbedConfigMock, as: ConfigMock
alias Pleroma.MogrifyMock
+ alias Pleroma.StaticStubbedConfigMock, as: ConfigMock
+ alias Pleroma.Upload.Filter
setup :verify_on_exit!
diff --git a/test/pleroma/upload/filter_test.exs b/test/pleroma/upload/filter_test.exs
@@ -6,8 +6,8 @@ defmodule Pleroma.Upload.FilterTest do
use Pleroma.DataCase
import Mox
- alias Pleroma.Upload.Filter
alias Pleroma.StaticStubbedConfigMock, as: ConfigMock
+ alias Pleroma.Upload.Filter
test "applies filters" do
ConfigMock
diff --git a/test/pleroma/web/plugs/instance_static_test.exs b/test/pleroma/web/plugs/instance_static_test.exs
@@ -114,7 +114,7 @@ defmodule Pleroma.Web.Plugs.InstanceStaticTest do
_ -> nil
end)
- # It should have been sanitized to application/octet-stream because "application"
+ # It should have been sanitized to application/octet-stream because "application"
# is not in the allowed_mime_types list
assert content_type == "application/octet-stream"