From 3141db8bf2a4f8899952a40dc95ae5af1794b15a Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Wed, 20 May 2020 14:23:57 -0400 Subject: [PATCH] mix format --- lib/philomena/reports.ex | 1 + .../controllers/image/navigate_controller.ex | 4 +++- .../tag/autocomplete_controller.ex | 2 +- .../controllers/tag_controller.ex | 5 ++++- .../controllers/topic_controller.ex | 4 +++- lib/philomena_web/image_loader.ex | 5 ++++- lib/philomena_web/stats_updater.ex | 20 ++++++++++--------- lib/philomena_web/textile_renderer.ex | 2 +- mix.exs | 2 +- 9 files changed, 29 insertions(+), 16 deletions(-) diff --git a/lib/philomena/reports.ex b/lib/philomena/reports.ex index 1a4ba9b2..4d03feb4 100644 --- a/lib/philomena/reports.ex +++ b/lib/philomena/reports.ex @@ -139,6 +139,7 @@ defmodule Philomena.Reports do result end + defp maybe_reindex_report(result), do: result def reindex_reports(report_ids) do diff --git a/lib/philomena_web/controllers/image/navigate_controller.ex b/lib/philomena_web/controllers/image/navigate_controller.ex index 996f4ec5..360c1632 100644 --- a/lib/philomena_web/controllers/image/navigate_controller.ex +++ b/lib/philomena_web/controllers/image/navigate_controller.ex @@ -15,7 +15,9 @@ defmodule PhilomenaWeb.Image.NavigateController do filter = conn.assigns.compiled_filter rel = String.to_existing_atom(rel) - next_image = ImageNavigator.find_consecutive(conn, image, rel, params, compile_query(conn), filter) + next_image = + ImageNavigator.find_consecutive(conn, image, rel, params, compile_query(conn), filter) + scope = ImageScope.scope(conn) conn diff --git a/lib/philomena_web/controllers/tag/autocomplete_controller.ex b/lib/philomena_web/controllers/tag/autocomplete_controller.ex index ca16f3f5..b462b2dd 100644 --- a/lib/philomena_web/controllers/tag/autocomplete_controller.ex +++ b/lib/philomena_web/controllers/tag/autocomplete_controller.ex @@ -29,7 +29,7 @@ defmodule PhilomenaWeb.Tag.AutocompleteController do Tag |> preload(:aliased_tag) ) |> Enum.map(&(&1.aliased_tag || &1)) - |> Enum.uniq_by(&(&1.id)) + |> Enum.uniq_by(& &1.id) |> Enum.sort_by(&(-&1.images_count)) |> Enum.map(&%{label: "#{&1.name} (#{&1.images_count})", value: &1.name}) end diff --git a/lib/philomena_web/controllers/tag_controller.ex b/lib/philomena_web/controllers/tag_controller.ex index 03f613a9..de7dc727 100644 --- a/lib/philomena_web/controllers/tag_controller.ex +++ b/lib/philomena_web/controllers/tag_controller.ex @@ -61,7 +61,10 @@ defmodule PhilomenaWeb.TagController do body = TextileRenderer.render_one(%{body: tag.description || ""}, conn) dnp_bodies = - TextileRenderer.render_collection(Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}), conn) + TextileRenderer.render_collection( + Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}), + conn + ) dnp_entries = Enum.zip(dnp_bodies, tag.dnp_entries) diff --git a/lib/philomena_web/controllers/topic_controller.ex b/lib/philomena_web/controllers/topic_controller.ex index 8ba63c47..e96ab7ad 100644 --- a/lib/philomena_web/controllers/topic_controller.ex +++ b/lib/philomena_web/controllers/topic_controller.ex @@ -133,7 +133,9 @@ defmodule PhilomenaWeb.TopicController do {:error, _changeset} -> conn |> put_flash(:error, "There was an error with your submission. Please try again.") - |> redirect(to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, conn.assigns.topic)) + |> redirect( + to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, conn.assigns.topic) + ) end end diff --git a/lib/philomena_web/image_loader.ex b/lib/philomena_web/image_loader.ex index 5769c005..595a65a7 100644 --- a/lib/philomena_web/image_loader.ex +++ b/lib/philomena_web/image_loader.ex @@ -136,7 +136,10 @@ defmodule PhilomenaWeb.ImageLoader do defp render_bodies([tag], conn) do dnp_bodies = - TextileRenderer.render_collection(Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}), conn) + TextileRenderer.render_collection( + Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}), + conn + ) dnp_entries = Enum.zip(dnp_bodies, tag.dnp_entries) diff --git a/lib/philomena_web/stats_updater.ex b/lib/philomena_web/stats_updater.ex index edeccc12..21063bcb 100644 --- a/lib/philomena_web/stats_updater.ex +++ b/lib/philomena_web/stats_updater.ex @@ -61,16 +61,18 @@ defmodule PhilomenaWeb.StatsUpdater do now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) - static_page = - %{ - title: "Statistics", - slug: "stats", - body: Phoenix.HTML.safe_to_string(result), - created_at: now, - updated_at: now - } + static_page = %{ + title: "Statistics", + slug: "stats", + body: Phoenix.HTML.safe_to_string(result), + created_at: now, + updated_at: now + } - Repo.insert_all(StaticPage, [static_page], on_conflict: {:replace, [:body, :updated_at]}, conflict_target: :slug) + Repo.insert_all(StaticPage, [static_page], + on_conflict: {:replace, [:body, :updated_at]}, + conflict_target: :slug + ) run() end diff --git a/lib/philomena_web/textile_renderer.ex b/lib/philomena_web/textile_renderer.ex index 76a4462d..193b3ba7 100644 --- a/lib/philomena_web/textile_renderer.ex +++ b/lib/philomena_web/textile_renderer.ex @@ -110,7 +110,7 @@ defmodule PhilomenaWeb.TextileRenderer do |> Enum.flat_map(fn t -> Regex.scan(~r|>>(\d+)|, t, capture: :all_but_first) |> Enum.map(fn [first] -> String.to_integer(first) end) - |> Enum.filter(&(&1 < 2147483647)) + |> Enum.filter(&(&1 < 2_147_483_647)) end) |> load_images() end diff --git a/mix.exs b/mix.exs index d8ed0d7b..ef422d62 100644 --- a/mix.exs +++ b/mix.exs @@ -67,7 +67,7 @@ defmodule Philomena.MixProject do {:tesla, "~> 1.3"}, {:castore, "~> 0.1"}, {:mint, "~> 1.0"}, - {:dialyxir, "~> 1.0", only: :dev, runtime: false}, + {:dialyxir, "~> 1.0", only: :dev, runtime: false} ] end