From cb91dab75f70ade96028c32e270a27352c41714e Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 31 May 2024 07:19:48 +0200 Subject: [PATCH] Switch formatting checks to Elixir 1.15 --- .gitlab-ci.yml | 4 +-- lib/mix/tasks/pleroma/database.ex | 2 +- lib/pleroma/emoji/pack.ex | 6 ++--- lib/pleroma/object/updater.ex | 5 +++- lib/pleroma/user/backup.ex | 12 ++++----- .../api_spec/operations/search_operation.ex | 4 ++- lib/pleroma/web/auth/ldap_authenticator.ex | 2 +- .../web/mastodon_api/websocket_handler.ex | 2 +- lib/pleroma/web/plugs/o_auth_scopes_plug.ex | 4 ++- lib/pleroma/web/xml.ex | 2 +- ...180516154905_create_user_trigram_index.exs | 5 +++- .../20190118074940_fix_user_trigram_index.exs | 5 +++- ...0190603173419_add_tag_index_to_objects.exs | 5 +++- .../20200919182636_remoteip_plug_rename.exs | 4 ++- test/pleroma/config_db_test.exs | 2 +- test/pleroma/http/adapter_helper/gun_test.exs | 12 ++++----- test/pleroma/http/adapter_helper_test.exs | 4 +-- test/pleroma/job_queue_monitor_test.exs | 12 ++++----- test/pleroma/notification_test.exs | 5 +++- test/pleroma/user/backup_test.exs | 10 +++---- test/pleroma/web/feed/tag_controller_test.exs | 26 +++++++++---------- .../pleroma/web/feed/user_controller_test.exs | 12 ++++----- .../mastodon_api/views/status_view_test.exs | 4 ++- .../web/o_auth/ldap_authorization_test.exs | 2 +- .../emoji_pack_controller_test.exs | 6 ++--- test/pleroma/web/push/impl_test.exs | 5 +++- 26 files changed, 94 insertions(+), 68 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 45dcd6091..6b67047f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -169,9 +169,9 @@ unit-testing-1.13.4-otp-25-erratic: - mix ecto.migrate - mix test --only=erratic -formatting-1.13: +formatting-1.15: extends: .build_changes_policy - image: &formatting_elixir elixir:1.13-alpine + image: &formatting_elixir elixir:1.15-alpine stage: lint cache: *testing_cache_policy before_script: ¤t_bfr_script diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 13ac6536c..b82d1f079 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -351,7 +351,7 @@ defmodule Mix.Tasks.Pleroma.Database do ) end - shell_info('Done.') + shell_info(~c"Done.") end end diff --git a/lib/pleroma/emoji/pack.ex b/lib/pleroma/emoji/pack.ex index afc341853..785fdb8b2 100644 --- a/lib/pleroma/emoji/pack.ex +++ b/lib/pleroma/emoji/pack.ex @@ -416,10 +416,10 @@ defmodule Pleroma.Emoji.Pack do end defp create_archive_and_cache(pack, hash) do - files = ['pack.json' | Enum.map(pack.files, fn {_, file} -> to_charlist(file) end)] + files = [~c"pack.json" | Enum.map(pack.files, fn {_, file} -> to_charlist(file) end)] {:ok, {_, result}} = - :zip.zip('#{pack.name}.zip', files, [:memory, cwd: to_charlist(pack.path)]) + :zip.zip(~c"#{pack.name}.zip", files, [:memory, cwd: to_charlist(pack.path)]) ttl_per_file = Pleroma.Config.get!([:emoji, :shared_pack_cache_seconds_per_file]) overall_ttl = :timer.seconds(ttl_per_file * Enum.count(files)) @@ -586,7 +586,7 @@ defmodule Pleroma.Emoji.Pack do with :ok <- File.mkdir_p!(local_pack.path) do files = Enum.map(remote_pack["files"], fn {_, path} -> to_charlist(path) end) # Fallback cannot contain a pack.json file - files = if pack_info[:fallback], do: files, else: ['pack.json' | files] + files = if pack_info[:fallback], do: files, else: [~c"pack.json" | files] :zip.unzip(archive, cwd: to_charlist(local_pack.path), file_list: files) end diff --git a/lib/pleroma/object/updater.ex b/lib/pleroma/object/updater.ex index b1e4870ba..b80bc7faf 100644 --- a/lib/pleroma/object/updater.ex +++ b/lib/pleroma/object/updater.ex @@ -134,7 +134,10 @@ defmodule Pleroma.Object.Updater do else %{updated_object: updated_data} = updated_data - |> maybe_update_history(original_data, updated: updated, use_history_in_new_object?: false) + |> maybe_update_history(original_data, + updated: updated, + use_history_in_new_object?: false + ) updated_data |> Map.put("updated", date) diff --git a/lib/pleroma/user/backup.ex b/lib/pleroma/user/backup.ex index 65e0baccd..1821de667 100644 --- a/lib/pleroma/user/backup.ex +++ b/lib/pleroma/user/backup.ex @@ -197,12 +197,12 @@ defmodule Pleroma.User.Backup do end @files [ - 'actor.json', - 'outbox.json', - 'likes.json', - 'bookmarks.json', - 'followers.json', - 'following.json' + ~c"actor.json", + ~c"outbox.json", + ~c"likes.json", + ~c"bookmarks.json", + ~c"followers.json", + ~c"following.json" ] @spec export(Pleroma.User.Backup.t(), pid()) :: {:ok, String.t()} | :error def export(%__MODULE__{} = backup, caller_pid) do diff --git a/lib/pleroma/web/api_spec/operations/search_operation.ex b/lib/pleroma/web/api_spec/operations/search_operation.ex index 539743ba3..c2afe8e18 100644 --- a/lib/pleroma/web/api_spec/operations/search_operation.ex +++ b/lib/pleroma/web/api_spec/operations/search_operation.ex @@ -79,7 +79,9 @@ defmodule Pleroma.Web.ApiSpec.SearchOperation do %Schema{type: :string, enum: ["accounts", "hashtags", "statuses"]}, "Search type" ), - Operation.parameter(:q, :query, %Schema{type: :string}, "The search query", required: true), + Operation.parameter(:q, :query, %Schema{type: :string}, "The search query", + required: true + ), Operation.parameter( :resolve, :query, diff --git a/lib/pleroma/web/auth/ldap_authenticator.ex b/lib/pleroma/web/auth/ldap_authenticator.ex index e8cd4491c..17ffd820d 100644 --- a/lib/pleroma/web/auth/ldap_authenticator.ex +++ b/lib/pleroma/web/auth/ldap_authenticator.ex @@ -110,7 +110,7 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do } params = - case List.keyfind(attributes, 'mail', 0) do + case List.keyfind(attributes, ~c"mail", 0) do {_, [mail]} -> Map.put_new(params, :email, :erlang.list_to_binary(mail)) _ -> params end diff --git a/lib/pleroma/web/mastodon_api/websocket_handler.ex b/lib/pleroma/web/mastodon_api/websocket_handler.ex index bb27d806d..730295a4c 100644 --- a/lib/pleroma/web/mastodon_api/websocket_handler.ex +++ b/lib/pleroma/web/mastodon_api/websocket_handler.ex @@ -104,7 +104,7 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do end def handle_info(:close, state) do - {:stop, {:closed, 'connection closed by server'}, state} + {:stop, {:closed, ~c"connection closed by server"}, state} end def handle_info(msg, state) do diff --git a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex index faf0fd8c6..08c2f61ea 100644 --- a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex +++ b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex @@ -34,7 +34,9 @@ defmodule Pleroma.Web.Plugs.OAuthScopesPlug do permissions = Enum.join(missing_scopes, " #{op} ") error_message = - dgettext("errors", "Insufficient permissions: %{permissions}.", permissions: permissions) + dgettext("errors", "Insufficient permissions: %{permissions}.", + permissions: permissions + ) conn |> put_resp_content_type("application/json") diff --git a/lib/pleroma/web/xml.ex b/lib/pleroma/web/xml.ex index 64329e4ba..3997e1661 100644 --- a/lib/pleroma/web/xml.ex +++ b/lib/pleroma/web/xml.ex @@ -9,7 +9,7 @@ defmodule Pleroma.Web.XML do def string_from_xpath(xpath, doc) do try do - {:xmlObj, :string, res} = :xmerl_xpath.string('string(#{xpath})', doc) + {:xmlObj, :string, res} = :xmerl_xpath.string(~c"string(#{xpath})", doc) res = res diff --git a/priv/repo/migrations/20180516154905_create_user_trigram_index.exs b/priv/repo/migrations/20180516154905_create_user_trigram_index.exs index 68878e1e2..049b10175 100644 --- a/priv/repo/migrations/20180516154905_create_user_trigram_index.exs +++ b/priv/repo/migrations/20180516154905_create_user_trigram_index.exs @@ -7,7 +7,10 @@ defmodule Pleroma.Repo.Migrations.CreateUserTrigramIndex do def change do create_if_not_exists( - index(:users, ["(nickname || name) gist_trgm_ops"], name: :users_trigram_index, using: :gist) + index(:users, ["(nickname || name) gist_trgm_ops"], + name: :users_trigram_index, + using: :gist + ) ) end end diff --git a/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs b/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs index b0f5238a0..3958ea262 100644 --- a/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs +++ b/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs @@ -20,7 +20,10 @@ defmodule Pleroma.Repo.Migrations.FixUserTrigramIndex do drop_if_exists(index(:users, [], name: :users_trigram_index)) create_if_not_exists( - index(:users, ["(nickname || name) gist_trgm_ops"], name: :users_trigram_index, using: :gist) + index(:users, ["(nickname || name) gist_trgm_ops"], + name: :users_trigram_index, + using: :gist + ) ) end end diff --git a/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs b/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs index 00c71e95f..a3cb17f3b 100644 --- a/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs +++ b/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs @@ -7,7 +7,10 @@ defmodule Pleroma.Repo.Migrations.AddTagIndexToObjects do def change do drop_if_exists( - index(:activities, ["(data #> '{\"object\",\"tag\"}')"], using: :gin, name: :activities_tags) + index(:activities, ["(data #> '{\"object\",\"tag\"}')"], + using: :gin, + name: :activities_tags + ) ) create_if_not_exists(index(:objects, ["(data->'tag')"], using: :gin, name: :objects_tags)) diff --git a/priv/repo/migrations/20200919182636_remoteip_plug_rename.exs b/priv/repo/migrations/20200919182636_remoteip_plug_rename.exs index b9a8fd0e1..69627d3d8 100644 --- a/priv/repo/migrations/20200919182636_remoteip_plug_rename.exs +++ b/priv/repo/migrations/20200919182636_remoteip_plug_rename.exs @@ -9,7 +9,9 @@ defmodule Pleroma.Repo.Migrations.RemoteipPlugRename do def up do config = - from(c in Pleroma.ConfigDB, where: c.group == ^:pleroma and c.key == ^Pleroma.Plugs.RemoteIp) + from(c in Pleroma.ConfigDB, + where: c.group == ^:pleroma and c.key == ^Pleroma.Plugs.RemoteIp + ) |> Pleroma.Repo.one() if config do diff --git a/test/pleroma/config_db_test.exs b/test/pleroma/config_db_test.exs index e20da1574..d68e4e6fa 100644 --- a/test/pleroma/config_db_test.exs +++ b/test/pleroma/config_db_test.exs @@ -312,7 +312,7 @@ defmodule Pleroma.ConfigDBTest do test "proxy tuple with domain" do assert ConfigDB.to_elixir_types(%{ "tuple" => [":proxy_url", %{"tuple" => [":socks5", "domain.com", 1234]}] - }) == {:proxy_url, {:socks5, 'domain.com', 1234}} + }) == {:proxy_url, {:socks5, ~c"domain.com", 1234}} end test "proxy tuple with ip" do diff --git a/test/pleroma/http/adapter_helper/gun_test.exs b/test/pleroma/http/adapter_helper/gun_test.exs index d567bc844..568fd6fb3 100644 --- a/test/pleroma/http/adapter_helper/gun_test.exs +++ b/test/pleroma/http/adapter_helper/gun_test.exs @@ -55,23 +55,23 @@ defmodule Pleroma.HTTP.AdapterHelper.GunTest do uri = URI.parse("https://some-domain.com") opts = Gun.options([receive_conn: false], uri) - assert opts[:proxy] == {'localhost', 8123} + assert opts[:proxy] == {~c"localhost", 8123} end test "parses tuple proxy scheme host and port" do - clear_config([:http, :proxy_url], {:socks, 'localhost', 1234}) + clear_config([:http, :proxy_url], {:socks, ~c"localhost", 1234}) uri = URI.parse("https://some-domain.com") opts = Gun.options([receive_conn: false], uri) - assert opts[:proxy] == {:socks, 'localhost', 1234} + assert opts[:proxy] == {:socks, ~c"localhost", 1234} end test "passed opts have more weight than defaults" do - clear_config([:http, :proxy_url], {:socks5, 'localhost', 1234}) + clear_config([:http, :proxy_url], {:socks5, ~c"localhost", 1234}) uri = URI.parse("https://some-domain.com") - opts = Gun.options([receive_conn: false, proxy: {'example.com', 4321}], uri) + opts = Gun.options([receive_conn: false, proxy: {~c"example.com", 4321}], uri) - assert opts[:proxy] == {'example.com', 4321} + assert opts[:proxy] == {~c"example.com", 4321} end end end diff --git a/test/pleroma/http/adapter_helper_test.exs b/test/pleroma/http/adapter_helper_test.exs index e3c78f317..cc0e24167 100644 --- a/test/pleroma/http/adapter_helper_test.exs +++ b/test/pleroma/http/adapter_helper_test.exs @@ -17,12 +17,12 @@ defmodule Pleroma.HTTP.AdapterHelperTest do end test "localhost with port" do - assert AdapterHelper.format_proxy("localhost:8123") == {'localhost', 8123} + assert AdapterHelper.format_proxy("localhost:8123") == {~c"localhost", 8123} end test "tuple" do assert AdapterHelper.format_proxy({:socks4, :localhost, 9050}) == - {:socks4, 'localhost', 9050} + {:socks4, ~c"localhost", 9050} end end end diff --git a/test/pleroma/job_queue_monitor_test.exs b/test/pleroma/job_queue_monitor_test.exs index f2056990f..e2250d7e2 100644 --- a/test/pleroma/job_queue_monitor_test.exs +++ b/test/pleroma/job_queue_monitor_test.exs @@ -28,13 +28,13 @@ defmodule Pleroma.JobQueueMonitorTest do queue: "background", stack: [ {Pleroma.Workers.BackgroundWorker, :perform, 2, - [file: 'lib/pleroma/workers/background_worker.ex', line: 31]}, + [file: ~c"lib/pleroma/workers/background_worker.ex", line: 31]}, {Oban.Queue.Executor, :safe_call, 1, - [file: 'lib/oban/queue/executor.ex', line: 42]}, - {:timer, :tc, 3, [file: 'timer.erl', line: 197]}, - {Oban.Queue.Executor, :call, 2, [file: 'lib/oban/queue/executor.ex', line: 23]}, - {Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 90]}, - {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]} + [file: ~c"lib/oban/queue/executor.ex", line: 42]}, + {:timer, :tc, 3, [file: ~c"timer.erl", line: 197]}, + {Oban.Queue.Executor, :call, 2, [file: ~c"lib/oban/queue/executor.ex", line: 23]}, + {Task.Supervised, :invoke_mfa, 2, [file: ~c"lib/task/supervised.ex", line: 90]}, + {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 249]} ], worker: "Pleroma.Workers.BackgroundWorker" }} diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs index 2c582c708..21bea4c3f 100644 --- a/test/pleroma/notification_test.exs +++ b/test/pleroma/notification_test.exs @@ -339,7 +339,10 @@ defmodule Pleroma.NotificationTest do |> Repo.preload(:activity) assert %{type: "follow"} = - NotificationView.render("show.json", notification: notification, for: followed_user) + NotificationView.render("show.json", + notification: notification, + for: followed_user + ) end test "it doesn't create a notification for follow-unfollow-follow chains" do diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index 5503d15bc..753e35982 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -188,7 +188,7 @@ defmodule Pleroma.User.BackupTest do assert {:ok, backup} = user |> Backup.new() |> Repo.insert() assert {:ok, path} = Backup.export(backup, self()) assert {:ok, zipfile} = :zip.zip_open(String.to_charlist(path), [:memory]) - assert {:ok, {'actor.json', json}} = :zip.zip_get('actor.json', zipfile) + assert {:ok, {~c"actor.json", json}} = :zip.zip_get(~c"actor.json", zipfile) assert %{ "@context" => [ @@ -213,7 +213,7 @@ defmodule Pleroma.User.BackupTest do "url" => "http://cofe.io/users/cofe" } = Jason.decode!(json) - assert {:ok, {'outbox.json', json}} = :zip.zip_get('outbox.json', zipfile) + assert {:ok, {~c"outbox.json", json}} = :zip.zip_get(~c"outbox.json", zipfile) assert %{ "@context" => "https://www.w3.org/ns/activitystreams", @@ -244,7 +244,7 @@ defmodule Pleroma.User.BackupTest do "type" => "OrderedCollection" } = Jason.decode!(json) - assert {:ok, {'likes.json', json}} = :zip.zip_get('likes.json', zipfile) + assert {:ok, {~c"likes.json", json}} = :zip.zip_get(~c"likes.json", zipfile) assert %{ "@context" => "https://www.w3.org/ns/activitystreams", @@ -254,7 +254,7 @@ defmodule Pleroma.User.BackupTest do "type" => "OrderedCollection" } = Jason.decode!(json) - assert {:ok, {'bookmarks.json', json}} = :zip.zip_get('bookmarks.json', zipfile) + assert {:ok, {~c"bookmarks.json", json}} = :zip.zip_get(~c"bookmarks.json", zipfile) assert %{ "@context" => "https://www.w3.org/ns/activitystreams", @@ -264,7 +264,7 @@ defmodule Pleroma.User.BackupTest do "type" => "OrderedCollection" } = Jason.decode!(json) - assert {:ok, {'following.json', json}} = :zip.zip_get('following.json', zipfile) + assert {:ok, {~c"following.json", json}} = :zip.zip_get(~c"following.json", zipfile) assert %{ "@context" => "https://www.w3.org/ns/activitystreams", diff --git a/test/pleroma/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs index 58ab8f137..7d196b228 100644 --- a/test/pleroma/web/feed/tag_controller_test.exs +++ b/test/pleroma/web/feed/tag_controller_test.exs @@ -55,11 +55,11 @@ defmodule Pleroma.Web.Feed.TagControllerTest do xml = parse(response) - assert xpath(xml, ~x"//feed/title/text()") == '#pleromaart' + assert xpath(xml, ~x"//feed/title/text()") == ~c"#pleromaart" assert xpath(xml, ~x"//feed/entry/title/text()"l) == [ - '42 This is :moominmamm...', - 'yeah #PleromaArt' + ~c"42 This is :moominmamm...", + ~c"yeah #PleromaArt" ] assert xpath(xml, ~x"//feed/entry/author/name/text()"ls) == [user.nickname, user.nickname] @@ -73,10 +73,10 @@ defmodule Pleroma.Web.Feed.TagControllerTest do resp = response(conn, 200) xml = parse(resp) - assert xpath(xml, ~x"//feed/title/text()") == '#pleromaart' + assert xpath(xml, ~x"//feed/title/text()") == ~c"#pleromaart" assert xpath(xml, ~x"//feed/entry/title/text()"l) == [ - 'yeah #PleromaArt' + ~c"yeah #PleromaArt" ] end @@ -120,20 +120,20 @@ defmodule Pleroma.Web.Feed.TagControllerTest do |> response(200) xml = parse(response) - assert xpath(xml, ~x"//channel/title/text()") == '#pleromaart' + assert xpath(xml, ~x"//channel/title/text()") == ~c"#pleromaart" assert xpath(xml, ~x"//channel/description/text()"s) == "These are public toots tagged with #pleromaart. You can interact with them if you have an account anywhere in the fediverse." assert xpath(xml, ~x"//channel/link/text()") == - '#{Pleroma.Web.Endpoint.url()}/tags/pleromaart.rss' + ~c"#{Pleroma.Web.Endpoint.url()}/tags/pleromaart.rss" assert xpath(xml, ~x"//channel/webfeeds:logo/text()") == - '#{Pleroma.Web.Endpoint.url()}/static/logo.svg' + ~c"#{Pleroma.Web.Endpoint.url()}/static/logo.svg" assert xpath(xml, ~x"//channel/item/title/text()"l) == [ - '42 This is :moominmamm...', - 'yeah #PleromaArt' + ~c"42 This is :moominmamm...", + ~c"yeah #PleromaArt" ] assert xpath(xml, ~x"//channel/item/pubDate/text()"sl) == [ @@ -160,7 +160,7 @@ defmodule Pleroma.Web.Feed.TagControllerTest do |> response(200) xml = parse(response) - assert xpath(xml, ~x"//channel/title/text()") == '#pleromaart' + assert xpath(xml, ~x"//channel/title/text()") == ~c"#pleromaart" assert xpath(xml, ~x"//channel/description/text()"s) == "These are public toots tagged with #pleromaart. You can interact with them if you have an account anywhere in the fediverse." @@ -174,10 +174,10 @@ defmodule Pleroma.Web.Feed.TagControllerTest do resp = response(conn, 200) xml = parse(resp) - assert xpath(xml, ~x"//channel/title/text()") == '#pleromaart' + assert xpath(xml, ~x"//channel/title/text()") == ~c"#pleromaart" assert xpath(xml, ~x"//channel/item/title/text()"l) == [ - 'yeah #PleromaArt' + ~c"yeah #PleromaArt" ] end diff --git a/test/pleroma/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs index d3c4108de..1c17d47b4 100644 --- a/test/pleroma/web/feed/user_controller_test.exs +++ b/test/pleroma/web/feed/user_controller_test.exs @@ -88,7 +88,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do |> SweetXml.parse() |> SweetXml.xpath(~x"//entry/title/text()"l) - assert activity_titles == ['Won\'t, didn\'...', '2hu', '2hu & as'] + assert activity_titles == [~c"Won't, didn'...", ~c"2hu", ~c"2hu & as"] assert resp =~ FeedView.escape(object.data["content"]) assert resp =~ FeedView.escape(object.data["summary"]) assert resp =~ FeedView.escape(object.data["context"]) @@ -104,7 +104,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do |> SweetXml.parse() |> SweetXml.xpath(~x"//entry/title/text()"l) - assert activity_titles == ['2hu & as'] + assert activity_titles == [~c"2hu & as"] end test "gets a rss feed", %{conn: conn, user: user, object: object, max_id: max_id} do @@ -119,7 +119,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do |> SweetXml.parse() |> SweetXml.xpath(~x"//item/title/text()"l) - assert activity_titles == ['Won\'t, didn\'...', '2hu', '2hu & as'] + assert activity_titles == [~c"Won't, didn'...", ~c"2hu", ~c"2hu & as"] assert resp =~ FeedView.escape(object.data["content"]) assert resp =~ FeedView.escape(object.data["summary"]) assert resp =~ FeedView.escape(object.data["context"]) @@ -135,7 +135,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do |> SweetXml.parse() |> SweetXml.xpath(~x"//item/title/text()"l) - assert activity_titles == ['2hu & as'] + assert activity_titles == [~c"2hu & as"] end test "returns 404 for a missing feed", %{conn: conn} do @@ -167,7 +167,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do |> SweetXml.xpath(~x"//entry/title/text()"l) |> Enum.sort() - assert activity_titles == ['public', 'unlisted'] + assert activity_titles == [~c"public", ~c"unlisted"] end test "returns 404 when the user is remote", %{conn: conn} do @@ -208,7 +208,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do |> SweetXml.parse() |> SweetXml.xpath(~x"//entry/title/text()"l) - assert activity_titles == ['Won\'t, didn\'...', '2hu', '2hu & as'] + assert activity_titles == [~c"Won't, didn'...", ~c"2hu", ~c"2hu & as"] assert resp =~ FeedView.escape(object.data["content"]) assert resp =~ FeedView.escape(object.data["summary"]) assert resp =~ FeedView.escape(object.data["context"]) diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index 167692dfb..b341e43d4 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -467,7 +467,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do # Create a public post quoting the private post quote_private = - insert(:note_activity, note: insert(:note, data: %{"quoteUrl" => private_object.data["id"]})) + insert(:note_activity, + note: insert(:note, data: %{"quoteUrl" => private_object.data["id"]}) + ) status = StatusView.render("show.json", %{activity: quote_private}) diff --git a/test/pleroma/web/o_auth/ldap_authorization_test.exs b/test/pleroma/web/o_auth/ldap_authorization_test.exs index 5ab8236b5..07ce2eed8 100644 --- a/test/pleroma/web/o_auth/ldap_authorization_test.exs +++ b/test/pleroma/web/o_auth/ldap_authorization_test.exs @@ -71,7 +71,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do equalityMatch: fn _type, _value -> :ok end, wholeSubtree: fn -> :ok end, search: fn _connection, _options -> - {:ok, {:eldap_search_result, [{:eldap_entry, '', []}], []}} + {:ok, {:eldap_search_result, [{:eldap_entry, ~c"", []}], []}} end, close: fn _connection -> send(self(), :close_connection) diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs index 92334487c..10dcf0e62 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs @@ -159,8 +159,8 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do {:ok, arch} = :zip.unzip(resp, [:memory]) - assert Enum.find(arch, fn {n, _} -> n == 'pack.json' end) - assert Enum.find(arch, fn {n, _} -> n == 'blank.png' end) + assert Enum.find(arch, fn {n, _} -> n == ~c"pack.json" end) + assert Enum.find(arch, fn {n, _} -> n == ~c"blank.png" end) end test "non existing pack", %{conn: conn} do @@ -454,7 +454,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do method: :get, url: "https://nonshared-pack" } -> - {:ok, {'empty.zip', empty_arch}} = :zip.zip('empty.zip', [], [:memory]) + {:ok, {~c"empty.zip", empty_arch}} = :zip.zip(~c"empty.zip", [], [:memory]) text(empty_arch) end) diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs index c263a1280..24bdf37b6 100644 --- a/test/pleroma/web/push/impl_test.exs +++ b/test/pleroma/web/push/impl_test.exs @@ -351,7 +351,10 @@ defmodule Pleroma.Web.Push.ImplTest do user = insert(:user, nickname: "Bob") user2 = - insert(:user, nickname: "Rob", notification_settings: %{hide_notification_contents: false}) + insert(:user, + nickname: "Rob", + notification_settings: %{hide_notification_contents: false} + ) {:ok, activity} = CommonAPI.post(user, %{