Add dialyzer

pull/2/head
Doc Ritezel 7 years ago
parent 630d811159
commit 5c304fa592
  1. 2
      .dialyzer-ignore
  2. 2
      circle.yml
  3. 4
      lib/explorer/fetcher.ex
  4. 1
      lib/explorer/latest_block.ex
  5. 1
      lib/explorer/repo.ex
  6. 2
      lib/explorer/scheduler.ex
  7. 2
      lib/explorer/transaction.ex
  8. 6
      lib/explorer_web/gettext.ex
  9. 1
      lib/explorer_web/views/page_view.ex
  10. 3
      lib/mix/tasks/scrape.ex
  11. 10
      mix.exs
  12. 1
      mix.lock
  13. 3
      test/support/conn_case.ex
  14. 1
      test/support/factory.ex

@ -0,0 +1,2 @@
:0: Unknown function 'Elixir.ExUnit.Callbacks':'__merge__'/3
:0: Unknown function 'Elixir.ExUnit.CaseTemplate':'__proxy__'/2

@ -33,6 +33,7 @@ dependencies:
timeout: 3600
override:
- yes | mix do deps.get, local.rebar, deps.compile, compile
- mix dialyzer --plt
- cd assets && npm install && cd ..
cache_directories:
- ~/.asdf
@ -44,6 +45,7 @@ test:
pre:
- mix credo
- mix sobelow --private --compact --exit Low
- mix dialyzer --halt-exit-status
- cd assets && npm run eslint -- --format=junit --output-file="$CIRCLE_TEST_REPORTS/eslint/junit.xml" && cd ..
override:
- mix test

@ -5,14 +5,16 @@ defmodule Explorer.Fetcher do
@moduledoc false
@dialyzer {:nowarn_function, fetch: 1}
def fetch(block_number) do
block_number
|> download_block
|> extract_block
|> validate_block
|> Repo.insert
|> Repo.insert!
end
@dialyzer {:nowarn_function, download_block: 1}
def download_block(block_number) do
{:ok, block} = eth_get_block_by_number(block_number, true)
block

@ -4,6 +4,7 @@ defmodule Explorer.LatestBlock do
@moduledoc false
@dialyzer {:nowarn_function, fetch: 0}
def fetch do
get_latest_block() |> Fetcher.fetch
end

@ -1,5 +1,6 @@
defmodule Explorer.Repo do
use Ecto.Repo, otp_app: :explorer
@dialyzer {:nowarn_function, rollback: 1}
@doc """
Dynamically loads the repository url from the

@ -1,4 +1,4 @@
defmodule Explorer.Scheduler do
use Quantum.Scheduler, otp_app: :explorer
@moduledoc false
use Quantum.Scheduler, otp_app: :explorer
end

@ -20,7 +20,7 @@ defmodule Explorer.Transaction do
@optional_attrs ~w()a
@doc false
def changeset(%Transaction{} = transaction, attrs \\ :empty) do
def changeset(%Transaction{} = transaction, attrs \\ %{}) do
transaction
|> cast(attrs, [:block_id | @required_attrs], @optional_attrs)
|> validate_required(@required_attrs)

@ -21,4 +21,10 @@ defmodule ExplorerWeb.Gettext do
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :explorer
@dialyzer [{:nowarn_function, 'MACRO-dgettext': 3},
{:nowarn_function, 'MACRO-dgettext': 4},
{:nowarn_function, 'MACRO-dngettext': 5},
{:nowarn_function, 'MACRO-dngettext': 6},
]
end

@ -1,3 +1,4 @@
defmodule ExplorerWeb.PageView do
use ExplorerWeb, :view
@dialyzer :no_match
end

@ -5,8 +5,9 @@ defmodule Mix.Tasks.Scrape do
@shortdoc "Scrape the blockchain."
@moduledoc false
@dialyzer {:nowarn_function, run: 1}
def run(_) do
Mix.Task.run "app.start"
Mix.Task.run("app.start")
LatestBlock.fetch()
end
end

@ -7,10 +7,15 @@ defmodule Explorer.Mixfile do
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
compilers: [:phoenix, :gettext | Mix.compilers],
start_permanent: Mix.env == :prod,
aliases: aliases(),
deps: deps()
deps: deps(),
dialyzer: [
plt_add_deps: :transitive,
plt_add_apps: [:mix],
ignore_warnings: ".dialyzer-ignore"
]
]
end
@ -41,6 +46,7 @@ defmodule Explorer.Mixfile do
[
{:cowboy, "~> 1.0"},
{:credo, "~> 0.8", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 0.5", only: [:dev, :test], runtime: false},
{:ethereumex, github: "exthereum/ethereumex", commit: "262f1d81ae163ffb46e127283658249dac1c8318"}, # Waiting for this version to be pushed to Hex.
{:ex_machina, "~> 2.1", only: [:test]},
{:exvcr, "~> 0.8", only: :test},

@ -8,6 +8,7 @@
"crontab": {:hex, :crontab, "1.1.2", "4784a50987b4a19af07a908f98e8a308b00f9c93efc5a7892155dc10cd8fc7d9", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 2.1", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
"db_connection": {:hex, :db_connection, "1.1.3", "89b30ca1ef0a3b469b1c779579590688561d586694a3ce8792985d4d7e575a61", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
"decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [:mix], [], "hexpm"},
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"},
"ecto": {:hex, :ecto, "2.2.8", "a4463c0928b970f2cee722cd29aaac154e866a15882c5737e0038bbfcf03ec2c", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
"ethereumex": {:git, "https://github.com/exthereum/ethereumex.git", "262f1d81ae163ffb46e127283658249dac1c8318", []},
"ex_machina": {:hex, :ex_machina, "2.1.0", "4874dc9c78e7cf2d429f24dc3c4005674d4e4da6a08be961ffccc08fb528e28b", [:mix], [{:ecto, "~> 2.1", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},

@ -28,7 +28,7 @@ defmodule ExplorerWeb.ConnCase do
end
end
@dialyzer {:nowarn_function, __ex_unit_setup_0: 1}
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Explorer.Repo)
unless tags[:async] do
@ -36,5 +36,4 @@ defmodule ExplorerWeb.ConnCase do
end
{:ok, conn: Phoenix.ConnTest.build_conn()}
end
end

@ -1,4 +1,5 @@
defmodule Explorer.Factory do
@dialyzer {:nowarn_function, fields_for: 1}
use ExMachina.Ecto, repo: Explorer.Repo
use Explorer.BlockFactory
use Explorer.TransactionFactory

Loading…
Cancel
Save