From ab4aa5720aeac8541fbf99e6c98e7260cb19d41e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 4 May 2018 20:59:01 +0000 Subject: [PATCH] Fix a bunch of unused variable warnings --- lib/pleroma/plugs/http_signature.ex | 4 ++-- lib/pleroma/web/activity_pub/mrf/simple_policy.ex | 2 +- lib/pleroma/web/activity_pub/transmogrifier.ex | 4 ++-- lib/pleroma/web/common_api/utils.ex | 4 ++-- lib/pleroma/web/federator/federator.ex | 8 ++++---- lib/pleroma/web/http_signatures/http_signatures.ex | 2 +- lib/pleroma/web/twitter_api/twitter_api.ex | 4 ++-- lib/pleroma/web/xml/xml.ex | 2 +- test/support/builders/activity_builder.ex | 2 +- test/support/httpoison_mock.ex | 6 +++--- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/pleroma/plugs/http_signature.ex b/lib/pleroma/plugs/http_signature.ex index 8b9ccdd2d..efde652f5 100644 --- a/lib/pleroma/plugs/http_signature.ex +++ b/lib/pleroma/plugs/http_signature.ex @@ -7,11 +7,11 @@ defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do options end - def call(%{assigns: %{valid_signature: true}} = conn, opts) do + def call(%{assigns: %{valid_signature: true}} = conn, _opts) do conn end - def call(conn, opts) do + def call(conn, _opts) do user = conn.params["actor"] Logger.debug("Checking sig for #{user}") [signature | _] = get_req_header(conn, "signature") diff --git a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex index ea1af0f4d..ad28cbfe3 100644 --- a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex @@ -70,7 +70,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do {:ok, object} <- check_ftl_removal(actor_info, object) do {:ok, object} else - e -> {:reject, nil} + _e -> {:reject, nil} end end end diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 2871a2544..221bc7dab 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -143,12 +143,12 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do end def handle_incoming( - %{"type" => "Like", "object" => object_id, "actor" => actor, "id" => id} = data + %{"type" => "Like", "object" => object_id, "actor" => actor, "id" => id} = _data ) do with %User{} = actor <- User.get_or_fetch_by_ap_id(actor), {:ok, object} <- get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id), - {:ok, activity, object} <- ActivityPub.like(actor, object, id, false) do + {:ok, activity, _object} <- ActivityPub.like(actor, object, id, false) do {:ok, activity} else _e -> :error diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 3c092d524..b142eda95 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -49,7 +49,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do {[user.follower_address | to], cc} end - def to_for_user_and_mentions(user, mentions, inReplyTo, "direct") do + def to_for_user_and_mentions(_user, mentions, inReplyTo, "direct") do mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end) if inReplyTo do @@ -69,7 +69,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do def make_context(%Activity{data: %{"context" => context}}), do: context def make_context(_), do: Utils.generate_context_id() - def maybe_add_attachments(text, attachments, _no_links = true), do: text + def maybe_add_attachments(text, _attachments, _no_links = true), do: text def maybe_add_attachments(text, attachments, _no_links) do add_attachments(text, attachments) diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index 8335add9c..c4c18192c 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -89,12 +89,12 @@ defmodule Pleroma.Web.Federator do with {:ok, _user} <- ap_enabled_actor(params["actor"]), nil <- Activity.get_by_ap_id(params["id"]), - {:ok, activity} <- Transmogrifier.handle_incoming(params) do + {:ok, _activity} <- Transmogrifier.handle_incoming(params) do else %Activity{} -> Logger.info("Already had #{params["id"]}") - e -> + _e -> # Just drop those for now Logger.info("Unhandled activity") Logger.info(Poison.encode!(params, pretty: 2)) @@ -154,7 +154,7 @@ defmodule Pleroma.Web.Federator do end end - def handle_cast({:enqueue, type, payload, priority}, state) + def handle_cast({:enqueue, type, payload, _priority}, state) when type in [:incoming_doc, :incoming_ap_doc] do %{in: {i_running_jobs, i_queue}, out: {o_running_jobs, o_queue}} = state i_queue = enqueue_sorted(i_queue, {type, payload}, 1) @@ -162,7 +162,7 @@ defmodule Pleroma.Web.Federator do {:noreply, %{in: {i_running_jobs, i_queue}, out: {o_running_jobs, o_queue}}} end - def handle_cast({:enqueue, type, payload, priority}, state) do + def handle_cast({:enqueue, type, payload, _priority}, state) do %{in: {i_running_jobs, i_queue}, out: {o_running_jobs, o_queue}} = state o_queue = enqueue_sorted(o_queue, {type, payload}, 1) {o_running_jobs, o_queue} = maybe_start_job(o_running_jobs, o_queue) diff --git a/lib/pleroma/web/http_signatures/http_signatures.ex b/lib/pleroma/web/http_signatures/http_signatures.ex index 0ea3b7554..9035f5eb6 100644 --- a/lib/pleroma/web/http_signatures/http_signatures.ex +++ b/lib/pleroma/web/http_signatures/http_signatures.ex @@ -45,7 +45,7 @@ defmodule Pleroma.Web.HTTPSignatures do end end else - e -> + _e -> Logger.debug("Could not public key!") false end diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index c12cd7f8a..5a843a3ab 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -184,7 +184,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do defp parse_int(_, default), do: default - def search(user, %{"q" => query} = params) do + def search(_user, %{"q" => query} = params) do limit = parse_int(params["rpp"], 20) page = parse_int(params["page"], 1) offset = (page - 1) * limit @@ -206,7 +206,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do order_by: [desc: :inserted_at] ) - activities = Repo.all(q) + _activities = Repo.all(q) end defp make_date do diff --git a/lib/pleroma/web/xml/xml.ex b/lib/pleroma/web/xml/xml.ex index 8b609f695..36430a3fa 100644 --- a/lib/pleroma/web/xml/xml.ex +++ b/lib/pleroma/web/xml/xml.ex @@ -14,7 +14,7 @@ defmodule Pleroma.Web.XML do if res == "", do: nil, else: res catch - e -> + _e -> Logger.debug("Couldn't find xpath #{xpath} in XML doc") nil end diff --git a/test/support/builders/activity_builder.ex b/test/support/builders/activity_builder.ex index d9c188955..eb72d5ba9 100644 --- a/test/support/builders/activity_builder.ex +++ b/test/support/builders/activity_builder.ex @@ -26,7 +26,7 @@ defmodule Pleroma.Builders.ActivityBuilder do end def insert_list(times, data \\ %{}, opts \\ %{}) do - Enum.map(1..times, fn n -> + Enum.map(1..times, fn _n -> {:ok, activity} = insert(data, opts) activity end) diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index ba35c4460..4a5a9ea85 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -367,7 +367,7 @@ defmodule HTTPoisonMock do def post( "https://social.heldscal.la/main/push/hub", - {:form, data}, + {:form, _data}, "Content-type": "application/x-www-form-urlencoded" ) do {:ok, @@ -711,11 +711,11 @@ defmodule HTTPoisonMock do }"} end - def post(url, body, headers) do + def post(url, _body, _headers) do {:error, "Not implemented the mock response for post #{inspect(url)}"} end - def post(url, body, headers, options) do + def post(url, _body, _headers, _options) do {:error, "Not implemented the mock response for post #{inspect(url)}"} end end