From c82d7ea79ae3867a9fd123e485351c882e1dc8c5 Mon Sep 17 00:00:00 2001 From: CJ Bryan and Desmond Bowe Date: Wed, 28 Feb 2018 12:38:44 -0800 Subject: [PATCH] Fix some issues with Credo and Dialyzer. --- .sobelow-conf | 2 +- lib/explorer/schemas/schema.ex | 2 ++ lib/giant_address_migrator.ex | 14 ++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.sobelow-conf b/.sobelow-conf index de91c7a5de..5df9abf534 100644 --- a/.sobelow-conf +++ b/.sobelow-conf @@ -6,5 +6,5 @@ exit: "low", format: "compact", ignore: ["Config.CSRF", "Vuln.Coherence"], - ignore_files: [""] + ignore_files: ["lib/giant_address_migrator.ex"] ] diff --git a/lib/explorer/schemas/schema.ex b/lib/explorer/schemas/schema.ex index 1799eb4add..752e4e9374 100644 --- a/lib/explorer/schemas/schema.ex +++ b/lib/explorer/schemas/schema.ex @@ -1,4 +1,6 @@ defmodule Explorer.Schema do + @moduledoc "Common configuration for Explorer schemas." + defmacro __using__(_opts) do quote do use Ecto.Schema diff --git a/lib/giant_address_migrator.ex b/lib/giant_address_migrator.ex index 97befb2a8b..d9e62c333b 100644 --- a/lib/giant_address_migrator.ex +++ b/lib/giant_address_migrator.ex @@ -1,11 +1,17 @@ defmodule GiantAddressMigrator do + @moduledoc "Migrate away from Address join tables." + + require Logger + + alias Explorer.Repo + def migrate do for n <- 1..20 do chunk_size = 500_000 lower = n * chunk_size - chunk_size upper = n * chunk_size - IO.inspect("fetching results between #{lower} and #{upper}") + Logger.info("fetching results between #{lower} and #{upper}") work_on_transactions_between_ids(lower, upper) end end @@ -20,8 +26,8 @@ defmodule GiantAddressMigrator do ; """ - {:ok, result} = Explorer.Repo.query(query, []) - IO.inspect("got em!") + {:ok, result} = Repo.query(query, []) + Logger.info("got em!") result.rows |> Enum.each(&sweet_update/1) @@ -32,7 +38,7 @@ defmodule GiantAddressMigrator do UPDATE transactions SET from_address_id = $1, to_address_id = $2 WHERE id = $3 """ - {:ok, status} = Explorer.Repo.query(query, [from_address_id, to_address_id, transaction_id]) + {:ok, _status} = Repo.query(query, [from_address_id, to_address_id, transaction_id]) end def sweet_update(_), do: nil