From a17910a6c6dca88d98218bf9782b05b70b69446f Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 6 Oct 2021 08:08:21 +0200 Subject: [PATCH] CI: Bump lint stage to elixir-1.12 Elixir 1.12 changed formatting rules, this allows to avoid having to rollback to run `mix format` --- .gitlab-ci.yml | 1 + lib/mix/tasks/pleroma/config.ex | 4 +--- lib/mix/tasks/pleroma/user.ex | 24 +++++-------------- lib/pleroma/bbs/handler.ex | 4 +--- lib/pleroma/config/oban.ex | 4 +--- lib/pleroma/config/transfer_task.ex | 4 +--- lib/pleroma/emoji/loader.ex | 8 ++----- lib/pleroma/gun/conn.ex | 8 ++----- lib/pleroma/moderation_log.ex | 8 ++----- lib/pleroma/telemetry/logger.ex | 8 ++----- lib/pleroma/web/activity_pub/activity_pub.ex | 4 +--- lib/pleroma/web/activity_pub/mrf.ex | 4 +--- .../activity_pub/mrf/steal_emoji_policy.ex | 4 +--- .../web/activity_pub/mrf/subchain_policy.ex | 4 +--- lib/pleroma/web/common_api.ex | 4 +--- .../web/mastodon_api/websocket_handler.ex | 8 ++----- ...12164525_fill_recipients_in_activities.exs | 4 +--- ...338_insert_skeletons_for_deleted_users.exs | 4 +--- test/pleroma/emails/admin_email_test.exs | 6 +---- test/pleroma/formatter_test.exs | 20 +++------------- test/pleroma/moderation_log_test.exs | 4 +--- test/pleroma/user_test.exs | 4 +--- .../controllers/admin_api_controller_test.exs | 12 +++------- .../controllers/report_controller_test.exs | 4 +--- test/pleroma/web/common_api/utils_test.exs | 18 +++----------- test/pleroma/web/common_api_test.exs | 4 +--- .../controllers/account_controller_test.exs | 4 +--- .../notification_controller_test.exs | 8 ++----- .../controllers/search_controller_test.exs | 12 ++-------- .../mastodon_api/update_credentials_test.exs | 4 +--- .../media_proxy_controller_test.exs | 4 +--- .../controllers/account_controller_test.exs | 4 +--- .../parser/ttl/aws_signed_url_test.exs | 4 +--- .../web/twitter_api/twitter_api_test.exs | 4 +--- .../web/twitter_api/util_controller_test.exs | 12 ++-------- .../web_finger/web_finger_controller_test.exs | 4 +--- test/support/api_spec_helpers.ex | 4 +--- test/support/conn_case.ex | 4 +--- test/support/http_request_mock.ex | 12 +++------- 39 files changed, 60 insertions(+), 201 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f14b1aa1..9041443c5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -134,6 +134,7 @@ unit-testing-rum: - mix test --preload-modules lint: + image: elixir:1.12 stage: test only: changes: diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index 22502a522..05ff8076f 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -286,9 +286,7 @@ defp migrate_from_db(opts) do file = File.open!(tmp_config_path) shell_info( - "Saving database configuration settings to #{tmp_config_path}. Copy it to the #{ - Path.dirname(config_path) - } manually." + "Saving database configuration settings to #{tmp_config_path}. Copy it to the #{Path.dirname(config_path)} manually." ) write_config(file, tmp_config_path, opts) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 53d5fc6d9..e848222b8 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -51,9 +51,7 @@ def run(["new", nickname, email | rest]) do A user will be created with the following information: - nickname: #{nickname} - email: #{email} - - password: #{ - if(generated_password?, do: "[generated; a reset link will be created]", else: password) - } + - password: #{if(generated_password?, do: "[generated; a reset link will be created]", else: password)} - name: #{name} - bio: #{bio} - moderator: #{if(moderator?, do: "true", else: "false")} @@ -114,15 +112,9 @@ def run(["reset_password", nickname]) do {:ok, token} <- Pleroma.PasswordResetToken.create_token(user) do shell_info("Generated password reset token for #{user.nickname}") - IO.puts( - "URL: #{ - Pleroma.Web.Router.Helpers.reset_password_url( - Pleroma.Web.Endpoint, - :reset, - token.token - ) - }" - ) + IO.puts("URL: #{Pleroma.Web.Router.Helpers.reset_password_url(Pleroma.Web.Endpoint, + :reset, + token.token)}") else _ -> shell_error("No local user #{nickname}") @@ -321,9 +313,7 @@ def run(["invites"]) do end shell_info( - "ID: #{invite.id} | Token: #{invite.token} | Token type: #{invite.invite_type} | Used: #{ - invite.used - }#{expire_info}#{using_info}" + "ID: #{invite.id} | Token: #{invite.token} | Token type: #{invite.invite_type} | Used: #{invite.used}#{expire_info}#{using_info}" ) end) end @@ -424,9 +414,7 @@ def run(["list"]) do users |> Enum.each(fn user -> shell_info( - "#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{ - user.is_locked - }, is_active: #{user.is_active}" + "#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{user.is_locked}, is_active: #{user.is_active}" ) end) end) diff --git a/lib/pleroma/bbs/handler.ex b/lib/pleroma/bbs/handler.ex index 4a2e255f7..a38faa5b8 100644 --- a/lib/pleroma/bbs/handler.ex +++ b/lib/pleroma/bbs/handler.ex @@ -19,9 +19,7 @@ def on_shell(username, _pubkey, _ip, _port) do def on_connect(username, ip, port, method) do Logger.debug(fn -> """ - Incoming SSH shell #{inspect(self())} requested for #{username} from #{inspect(ip)}:#{ - inspect(port) - } using #{inspect(method)} + Incoming SSH shell #{inspect(self())} requested for #{username} from #{inspect(ip)}:#{inspect(port)} using #{inspect(method)} """ end) end diff --git a/lib/pleroma/config/oban.ex b/lib/pleroma/config/oban.ex index 3e63bca40..53ea7d7be 100644 --- a/lib/pleroma/config/oban.ex +++ b/lib/pleroma/config/oban.ex @@ -21,9 +21,7 @@ def warn do """ !!!OBAN CONFIG WARNING!!! You are using old workers in Oban crontab settings, which were removed. - Please, remove setting from crontab in your config file (prod.secret.exs): #{ - inspect(setting) - } + Please, remove setting from crontab in your config file (prod.secret.exs): #{inspect(setting)} """ |> Logger.warn() diff --git a/lib/pleroma/config/transfer_task.ex b/lib/pleroma/config/transfer_task.ex index d5c6081a2..5371aae7a 100644 --- a/lib/pleroma/config/transfer_task.ex +++ b/lib/pleroma/config/transfer_task.ex @@ -148,9 +148,7 @@ defp update({group, key, value, merged}) do rescue error -> error_msg = - "updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{ - inspect(value) - } error: #{inspect(error)}" + "updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{inspect(value)} error: #{inspect(error)}" Logger.warn(error_msg) diff --git a/lib/pleroma/emoji/loader.ex b/lib/pleroma/emoji/loader.ex index 67acd7069..95937a892 100644 --- a/lib/pleroma/emoji/loader.ex +++ b/lib/pleroma/emoji/loader.ex @@ -60,9 +60,7 @@ def load do if not Enum.empty?(files) do Logger.warn( - "Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{ - Enum.join(files, ", ") - }" + "Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{Enum.join(files, ", ")}" ) end @@ -122,9 +120,7 @@ defp load_pack(pack_dir, emoji_groups) do extensions = Config.get([:emoji, :pack_extensions]) Logger.info( - "No emoji.txt found for pack \"#{pack_name}\", assuming all #{ - Enum.join(extensions, ", ") - } files are emoji" + "No emoji.txt found for pack \"#{pack_name}\", assuming all #{Enum.join(extensions, ", ")} files are emoji" ) make_shortcode_to_file_map(pack_dir, extensions) diff --git a/lib/pleroma/gun/conn.ex b/lib/pleroma/gun/conn.ex index a56625699..a1210eabf 100644 --- a/lib/pleroma/gun/conn.ex +++ b/lib/pleroma/gun/conn.ex @@ -57,9 +57,7 @@ defp do_open(uri, %{proxy: {proxy_host, proxy_port}} = opts) do else error -> Logger.warn( - "Opening proxied connection to #{compose_uri_log(uri)} failed with error #{ - inspect(error) - }" + "Opening proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" ) error @@ -93,9 +91,7 @@ defp do_open(uri, %{proxy: {proxy_type, proxy_host, proxy_port}} = opts) do else error -> Logger.warn( - "Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{ - inspect(error) - }" + "Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" ) error diff --git a/lib/pleroma/moderation_log.ex b/lib/pleroma/moderation_log.ex index 1849cacc8..993cff09b 100644 --- a/lib/pleroma/moderation_log.ex +++ b/lib/pleroma/moderation_log.ex @@ -481,9 +481,7 @@ def get_log_entry_message(%ModerationLog{ "visibility" => visibility } }) do - "@#{actor_nickname} updated status ##{subject_id}, set sensitive: '#{sensitive}', visibility: '#{ - visibility - }'" + "@#{actor_nickname} updated status ##{subject_id}, set sensitive: '#{sensitive}', visibility: '#{visibility}'" end def get_log_entry_message(%ModerationLog{ @@ -523,9 +521,7 @@ def get_log_entry_message(%ModerationLog{ "subject" => subjects } }) do - "@#{actor_nickname} re-sent confirmation email for users: #{ - users_to_nicknames_string(subjects) - }" + "@#{actor_nickname} re-sent confirmation email for users: #{users_to_nicknames_string(subjects)}" end def get_log_entry_message(%ModerationLog{ diff --git a/lib/pleroma/telemetry/logger.ex b/lib/pleroma/telemetry/logger.ex index 44d2f48dc..10165c1b2 100644 --- a/lib/pleroma/telemetry/logger.ex +++ b/lib/pleroma/telemetry/logger.ex @@ -29,9 +29,7 @@ def handle_event( _ ) do Logger.debug(fn -> - "Connection pool is exhausted (reached #{max_connections} connections). Starting idle connection cleanup to reclaim as much as #{ - reclaim_max - } connections" + "Connection pool is exhausted (reached #{max_connections} connections). Starting idle connection cleanup to reclaim as much as #{reclaim_max} connections" end) end @@ -73,9 +71,7 @@ def handle_event( _ ) do Logger.warn(fn -> - "Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{ - inspect(reason) - }" + "Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{inspect(reason)}" end) end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 19961a4a5..dbaf06e7a 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1597,9 +1597,7 @@ def maybe_handle_clashing_nickname(data) do %User{} = old_user <- User.get_by_nickname(nickname), {_, false} <- {:ap_id_comparison, data[:ap_id] == old_user.ap_id} do Logger.info( - "Found an old user for #{nickname}, the old ap id is #{old_user.ap_id}, new one is #{ - data[:ap_id] - }, renaming." + "Found an old user for #{nickname}, the old ap id is #{old_user.ap_id}, new one is #{data[:ap_id]}, renaming." ) old_user diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index e4ee8fe82..bd6f6777f 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -157,9 +157,7 @@ def config_descriptions(policies) do [description | acc] else Logger.warn( - "#{policy} config description doesn't have one or all required keys #{ - inspect(@required_description_keys) - }" + "#{policy} config description doesn't have one or all required keys #{inspect(@required_description_keys)}" ) acc diff --git a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex index fbe9795ac..0dd415732 100644 --- a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex @@ -38,9 +38,7 @@ defp steal_emoji({shortcode, url}, emoji_dir_path) do end else Logger.debug( - "MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{ - size_limit - } B)" + "MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{size_limit} B)" ) nil diff --git a/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex b/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex index f84d7cc71..11a36aca1 100644 --- a/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex @@ -23,9 +23,7 @@ defp lookup_subchain(actor) do def filter(%{"actor" => actor} = message) do with {:ok, match, subchain} <- lookup_subchain(actor) do Logger.debug( - "[SubchainPolicy] Matched #{actor} against #{inspect(match)} with subchain #{ - inspect(subchain) - }" + "[SubchainPolicy] Matched #{actor} against #{inspect(match)} with subchain #{inspect(subchain)}" ) MRF.filter(subchain, message) diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 1b5f8491e..6f685cb7b 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -487,9 +487,7 @@ def remove_mute(user_id, activity_id) do else {what, result} = error -> Logger.warn( - "CommonAPI.remove_mute/2 failed. #{what}: #{result}, user_id: #{user_id}, activity_id: #{ - activity_id - }" + "CommonAPI.remove_mute/2 failed. #{what}: #{result}, user_id: #{user_id}, activity_id: #{activity_id}" ) {:error, error} diff --git a/lib/pleroma/web/mastodon_api/websocket_handler.ex b/lib/pleroma/web/mastodon_api/websocket_handler.ex index 0d1faffbd..b978167b6 100644 --- a/lib/pleroma/web/mastodon_api/websocket_handler.ex +++ b/lib/pleroma/web/mastodon_api/websocket_handler.ex @@ -49,9 +49,7 @@ def init(%{qs: qs} = req, state) do def websocket_init(state) do Logger.debug( - "#{__MODULE__} accepted websocket connection for user #{ - (state.user || %{id: "anonymous"}).id - }, topic #{state.topic}" + "#{__MODULE__} accepted websocket connection for user #{(state.user || %{id: "anonymous"}).id}, topic #{state.topic}" ) Streamer.add_socket(state.topic, state.user) @@ -106,9 +104,7 @@ def terminate(_reason, _req, []), do: :ok def terminate(reason, _req, state) do Logger.debug( - "#{__MODULE__} terminating websocket connection for user #{ - (state.user || %{id: "anonymous"}).id - }, topic #{state.topic || "?"}: #{inspect(reason)}" + "#{__MODULE__} terminating websocket connection for user #{(state.user || %{id: "anonymous"}).id}, topic #{state.topic || "?"}: #{inspect(reason)}" ) Streamer.remove_socket(state.topic) diff --git a/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs b/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs index 6dfa93716..77a09781c 100644 --- a/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs +++ b/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs @@ -14,9 +14,7 @@ def up do max = min + 10_000 execute(""" - update activities set recipients = array(select jsonb_array_elements_text(data->'to')) where id > #{ - min - } and id <= #{max}; + update activities set recipients = array(select jsonb_array_elements_text(data->'to')) where id > #{min} and id <= #{max}; """) |> IO.inspect() end) diff --git a/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs b/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs index 2adc38186..81f941198 100644 --- a/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs +++ b/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs @@ -28,9 +28,7 @@ def change do {:ok, %{rows: ap_ids}} = Ecto.Adapters.SQL.query( Repo, - "select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{ - instance_uri - }/users/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;", + "select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{instance_uri}/users/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;", [], timeout: :infinity ) diff --git a/test/pleroma/emails/admin_email_test.exs b/test/pleroma/emails/admin_email_test.exs index 04c907697..e65752c23 100644 --- a/test/pleroma/emails/admin_email_test.exs +++ b/test/pleroma/emails/admin_email_test.exs @@ -27,11 +27,7 @@ test "build report email" do assert res.subject == "#{config[:name]} Report" assert res.html_body == - "

Reported by: #{reporter.nickname}

\n

Reported Account: #{account.nickname}

\n

Comment: Test comment\n

Statuses:\n

\n

\n\n

\nView Reports in AdminFE\n" + "

Reported by: #{reporter.nickname}

\n

Reported Account: #{account.nickname}

\n

Comment: Test comment\n

Statuses:\n

\n

\n\n

\nView Reports in AdminFE\n" end test "it works when the reporter is a remote user without email" do diff --git a/test/pleroma/formatter_test.exs b/test/pleroma/formatter_test.exs index 7f54638fb..b0f9f41b1 100644 --- a/test/pleroma/formatter_test.exs +++ b/test/pleroma/formatter_test.exs @@ -151,13 +151,7 @@ test "gives a replacement for user links, using local nicknames in user links te assert length(mentions) == 3 expected_text = - ~s(@gsimg According to @archa_eme_, that is @daggsy. Also hello @archaeme) + ~s(@gsimg According to @archa_eme_, that is @daggsy. Also hello @archaeme) assert expected_text == text end @@ -172,9 +166,7 @@ test "gives a replacement for user links when the user is using Osada" do assert length(mentions) == 1 expected_text = - ~s(@mike test) + ~s(@mike test) assert expected_text == text end @@ -210,13 +202,7 @@ test "given the 'safe_mention' option, it will only mention people in the beginn assert mentions == [{"@#{user.nickname}", user}, {"@#{other_user.nickname}", other_user}] assert expected_text == - ~s(@#{user.nickname} @#{other_user.nickname} hey dudes i hate @#{third_user.nickname}) + ~s(@#{user.nickname} @#{other_user.nickname} hey dudes i hate @#{third_user.nickname}) end test "given the 'safe_mention' option, it will still work without any mention" do diff --git a/test/pleroma/moderation_log_test.exs b/test/pleroma/moderation_log_test.exs index c6c170c45..607301815 100644 --- a/test/pleroma/moderation_log_test.exs +++ b/test/pleroma/moderation_log_test.exs @@ -236,9 +236,7 @@ test "logging report response", %{moderator: moderator} do log = Repo.get(ModerationLog, log2.id) assert log.data["message"] == - "@#{moderator.nickname} added note 'look at this' to report ##{report.id} on user @#{ - user.nickname - }" + "@#{moderator.nickname} added note 'look at this' to report ##{report.id} on user @#{user.nickname}" end test "logging status sensitivity update", %{moderator: moderator} do diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index d19fee45d..5fef81245 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1886,9 +1886,7 @@ test "preserves hosts in user links text" do bio = "A.k.a. @nick@domain.com" expected_text = - ~s(A.k.a. @nick@domain.com) + ~s(A.k.a. @nick@domain.com) assert expected_text == User.parse_bio(bio, user) end diff --git a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs index 8cd9f939b..262f93ec4 100644 --- a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs @@ -267,9 +267,7 @@ test "/:right DELETE, can remove from a permission group (multiple)", %{ log_entry = Repo.one(ModerationLog) assert ModerationLog.get_log_entry_message(log_entry) == - "@#{admin.nickname} revoked admin role from @#{user_one.nickname}, @#{ - user_two.nickname - }" + "@#{admin.nickname} revoked admin role from @#{user_one.nickname}, @#{user_two.nickname}" end end @@ -860,9 +858,7 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} do log_entry = Repo.one(ModerationLog) assert ModerationLog.get_log_entry_message(log_entry) == - "@#{admin.nickname} confirmed email for users: @#{first_user.nickname}, @#{ - second_user.nickname - }" + "@#{admin.nickname} confirmed email for users: @#{first_user.nickname}, @#{second_user.nickname}" end end @@ -883,9 +879,7 @@ test "it resend emails for two users", %{conn: conn, admin: admin} do log_entry = Repo.one(ModerationLog) assert ModerationLog.get_log_entry_message(log_entry) == - "@#{admin.nickname} re-sent confirmation email for users: @#{first_user.nickname}, @#{ - second_user.nickname - }" + "@#{admin.nickname} re-sent confirmation email for users: @#{first_user.nickname}, @#{second_user.nickname}" ObanHelpers.perform_all() diff --git a/test/pleroma/web/admin_api/controllers/report_controller_test.exs b/test/pleroma/web/admin_api/controllers/report_controller_test.exs index 8102845d5..99cc7bbd0 100644 --- a/test/pleroma/web/admin_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/report_controller_test.exs @@ -204,9 +204,7 @@ test "updates state of multiple reports", %{ "@#{admin.nickname} updated report ##{id} (on user @#{activity.user_actor.nickname}) with 'resolved' state" assert ModerationLog.get_log_entry_message(second_log_entry) == - "@#{admin.nickname} updated report ##{second_report_id} (on user @#{ - second_activity.user_actor.nickname - }) with 'closed' state" + "@#{admin.nickname} updated report ##{second_report_id} (on user @#{second_activity.user_actor.nickname}) with 'closed' state" end end diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index d8fec3520..fc01f820a 100644 --- a/test/pleroma/web/common_api/utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs @@ -160,11 +160,7 @@ test "works for text/markdown with mentions" do {output, _, _} = Utils.format_input(text, "text/markdown") assert output == - ~s(

hello world

another @user__test and @user__test google.com paragraph

) + ~s(

hello world

another @user__test and @user__test google.com paragraph

) end end @@ -201,11 +197,7 @@ test "local mentions" do {result, _, []} = Utils.format_input(code, "text/markdown") assert result == - ~s[

@mario @luigi yo what’s up?

] + ~s[

@mario @luigi yo what’s up?

] end test "remote mentions" do @@ -216,11 +208,7 @@ test "remote mentions" do {result, _, []} = Utils.format_input(code, "text/markdown") assert result == - ~s[

@mario @luigi yo what’s up?

] + ~s[

@mario @luigi yo what’s up?

] end test "raw HTML" do diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 4a10a5bc4..ad0b87543 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -209,9 +209,7 @@ test "it linkifies" do object = Object.normalize(activity, fetch: false) assert object.data["content"] == - "https://example.org is the site of @#{other_user.nickname} #2hu" + "https://example.org is the site of @#{other_user.nickname} #2hu" end test "it posts a chat message" do diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 3036e25b3..a92a58224 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -709,9 +709,7 @@ test "getting followers, pagination", %{user: user, conn: conn} do assert [%{"id" => ^follower2_id}, %{"id" => ^follower1_id}] = conn |> get( - "/api/v1/accounts/#{user.id}/followers?id=#{user.id}&limit=20&max_id=#{ - follower3_id - }" + "/api/v1/accounts/#{user.id}/followers?id=#{user.id}&limit=20&max_id=#{follower3_id}" ) |> json_response_and_validate_schema(200) diff --git a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs index 2615912a8..14bb7dae5 100644 --- a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs @@ -44,9 +44,7 @@ test "list of notifications" do |> get("/api/v1/notifications") expected_response = - "hi @#{user.nickname}" + "hi @#{user.nickname}" assert [%{"status" => %{"content" => response}} | _rest] = json_response_and_validate_schema(conn, 200) @@ -114,9 +112,7 @@ test "getting a single notification" do conn = get(conn, "/api/v1/notifications/#{notification.id}") expected_response = - "hi @#{user.nickname}" + "hi @#{user.nickname}" assert %{"status" => %{"content" => response}} = json_response_and_validate_schema(conn, 200) assert response == expected_response diff --git a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs index 7b0bbd8bd..e31cd0291 100644 --- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs @@ -125,13 +125,7 @@ test "constructs hashtags from search query", %{conn: conn} do results = conn |> get( - "/api/v2/search?#{ - URI.encode_query(%{ - q: - "https://www.washingtonpost.com/sports/2020/06/10/" <> - "nascar-ban-display-confederate-flag-all-events-properties/" - }) - }" + "/api/v2/search?#{URI.encode_query(%{q: "https://www.washingtonpost.com/sports/2020/06/10/" <> "nascar-ban-display-confederate-flag-all-events-properties/"})}" ) |> json_response_and_validate_schema(200) @@ -156,9 +150,7 @@ test "supports pagination of hashtags search results", %{conn: conn} do results = conn |> get( - "/api/v2/search?#{ - URI.encode_query(%{q: "#some #text #with #hashtags", limit: 2, offset: 1}) - }" + "/api/v2/search?#{URI.encode_query(%{q: "#some #text #with #hashtags", limit: 2, offset: 1})}" ) |> json_response_and_validate_schema(200) diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs index cf8ccf187..1d2027899 100644 --- a/test/pleroma/web/mastodon_api/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs @@ -88,9 +88,7 @@ test "updates the user's bio", %{conn: conn} do assert user_data = json_response_and_validate_schema(conn, 200) assert user_data["note"] == - ~s(I drink #cofe with @#{user2.nickname}

suya..) + ~s(I drink #cofe with @#{user2.nickname}

suya..) assert user_data["source"]["note"] == raw_bio diff --git a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs index 2a449e56d..1f2e54194 100644 --- a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs +++ b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs @@ -81,9 +81,7 @@ def assert_dependencies_installed do missing_dependencies = Pleroma.Helpers.MediaHelper.missing_dependencies() assert missing_dependencies == [], - "Error: missing dependencies (please refer to `docs/installation`): #{ - inspect(missing_dependencies) - }" + "Error: missing dependencies (please refer to `docs/installation`): #{inspect(missing_dependencies)}" end setup do diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs index 9f14c5577..ad271c31b 100644 --- a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs @@ -174,9 +174,7 @@ test "paginates favorites using since_id and max_id", %{ response = conn |> get( - "/api/v1/pleroma/accounts/#{user.id}/favourites?since_id=#{third_activity.id}&max_id=#{ - seventh_activity.id - }" + "/api/v1/pleroma/accounts/#{user.id}/favourites?since_id=#{third_activity.id}&max_id=#{seventh_activity.id}" ) |> json_response_and_validate_schema(:ok) diff --git a/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs index df3ea3e99..0c8203417 100644 --- a/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs +++ b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs @@ -66,9 +66,7 @@ test "s3 signed url is parsed and correct ttl is set for rich media" do end defp construct_s3_url(timestamp, valid_till) do - "https://pleroma.s3.ap-southeast-1.amazonaws.com/sachin%20%281%29%20_a%20-%25%2Aasdasd%20BNN%20bnnn%20.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIBLWWK6RGDQXDLJQ%2F20190716%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=#{ - timestamp - }&X-Amz-Expires=#{valid_till}&X-Amz-Signature=04ffd6b98634f4b1bbabc62e0fac4879093cd54a6eed24fe8eb38e8369526bbf&X-Amz-SignedHeaders=host" + "https://pleroma.s3.ap-southeast-1.amazonaws.com/sachin%20%281%29%20_a%20-%25%2Aasdasd%20BNN%20bnnn%20.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIBLWWK6RGDQXDLJQ%2F20190716%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=#{timestamp}&X-Amz-Expires=#{valid_till}&X-Amz-Signature=04ffd6b98634f4b1bbabc62e0fac4879093cd54a6eed24fe8eb38e8369526bbf&X-Amz-SignedHeaders=host" end defp construct_metadata(timestamp, valid_till, url) do diff --git a/test/pleroma/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs index 85629be04..2b8a4c3f5 100644 --- a/test/pleroma/web/twitter_api/twitter_api_test.exs +++ b/test/pleroma/web/twitter_api/twitter_api_test.exs @@ -139,9 +139,7 @@ test "it registers a new user and parses mentions in the bio" do {:ok, user2} = TwitterAPI.register_user(data2) expected_text = - ~s(@john test) + ~s(@john test) assert user2.bio == expected_text end diff --git a/test/pleroma/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs index 67bd4b27f..3380aec22 100644 --- a/test/pleroma/web/twitter_api/util_controller_test.exs +++ b/test/pleroma/web/twitter_api/util_controller_test.exs @@ -26,11 +26,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do test "it updates notification settings", %{user: user, conn: conn} do conn |> put( - "/api/pleroma/notification_settings?#{ - URI.encode_query(%{ - block_from_strangers: true - }) - }" + "/api/pleroma/notification_settings?#{URI.encode_query(%{block_from_strangers: true})}" ) |> json_response_and_validate_schema(:ok) @@ -45,11 +41,7 @@ test "it updates notification settings", %{user: user, conn: conn} do test "it updates notification settings to enable hiding contents", %{user: user, conn: conn} do conn |> put( - "/api/pleroma/notification_settings?#{ - URI.encode_query(%{ - hide_notification_contents: 1 - }) - }" + "/api/pleroma/notification_settings?#{URI.encode_query(%{hide_notification_contents: 1})}" ) |> json_response_and_validate_schema(:ok) diff --git a/test/pleroma/web/web_finger/web_finger_controller_test.exs b/test/pleroma/web/web_finger/web_finger_controller_test.exs index 2421c5800..66d79320f 100644 --- a/test/pleroma/web/web_finger/web_finger_controller_test.exs +++ b/test/pleroma/web/web_finger/web_finger_controller_test.exs @@ -24,9 +24,7 @@ test "GET host-meta" do assert response.status == 200 assert response.resp_body == - ~s() + ~s() end test "Webfinger JRD" do diff --git a/test/support/api_spec_helpers.ex b/test/support/api_spec_helpers.ex index 36d6a8b81..886e72d73 100644 --- a/test/support/api_spec_helpers.ex +++ b/test/support/api_spec_helpers.ex @@ -29,9 +29,7 @@ def assert_schema(value, schema) do end) flunk( - "Value does not conform to schema #{schema.title}: #{Enum.join(errors, "\n")}\n#{ - inspect(value) - }" + "Value does not conform to schema #{schema.title}: #{Enum.join(errors, "\n")}\n#{inspect(value)}" ) end end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index deee98599..eab469833 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -102,9 +102,7 @@ defp json_response_and_validate_schema( end) flunk( - "Response does not conform to schema of #{op_id} operation: #{ - Enum.join(errors, "\n") - }\n#{inspect(json)}" + "Response does not conform to schema of #{op_id} operation: #{Enum.join(errors, "\n")}\n#{inspect(json)}" ) end end diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 8807c2d14..94900dc14 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -1313,9 +1313,7 @@ def get("https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f", _, _, _ def get(url, query, body, headers) do {:error, - "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{ - inspect(headers) - }"} + "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"} end # POST Requests @@ -1381,9 +1379,7 @@ def post("http://404.site" <> _, _, _, _) do def post(url, query, body, headers) do {:error, - "Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{ - inspect(headers) - }"} + "Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"} end # Most of the rich media mocks are missing HEAD requests, so we just return 404. @@ -1398,8 +1394,6 @@ def head(url, _query, _body, _headers) when url in @rich_media_mocks do def head(url, query, body, headers) do {:error, - "Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{ - inspect(headers) - }"} + "Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"} end end