From 4f230ca16c8b1c35606c74db207700dfd4759ad4 Mon Sep 17 00:00:00 2001 From: epinault Date: Tue, 26 Mar 2024 09:05:27 -0700 Subject: [PATCH] setup dialyzer (#61) Co-authored-by: emmanuel.pinault --- .dialyzer.ignore-warnings | 5 +++++ mix.exs | 6 ++++++ mix.lock | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 .dialyzer.ignore-warnings diff --git a/.dialyzer.ignore-warnings b/.dialyzer.ignore-warnings new file mode 100644 index 0000000..a69c3de --- /dev/null +++ b/.dialyzer.ignore-warnings @@ -0,0 +1,5 @@ +lib/uinta/formatter/util.ex:62: Unknown type 'Elixir.Logger.Formatter':time/0 +lib/uinta/plug.ex:222: The test binary() == 'nil' can never evaluate to 'true' +lib/uinta/plug.ex:224: The pattern 'false' can never match the type 'true' +lib/uinta/plug.ex:257: The pattern <#{'query':=_query@1}, _> can never match the type <#{'operation':=binary(), 'type':=<<_:40,_:_*24>>, 'variables':=binary()},#{'filter_variables':=[binary()], 'format':='json' | 'map' | 'string', 'ignored_paths':=[binary()], 'include_datadog_fields':=boolean(), 'include_unnamed_queries':='true', 'include_variables':=boolean(), 'level':='alert' | 'critical' | 'debug' | 'emergency' | 'error' | 'info' | 'notice' | 'warn' | 'warning'}> +lib/uinta/plug.ex:262: The variable _ can never match since previous clauses completely covered the type #{'operation':=binary(), 'type':=<<_:40,_:_*24>>, 'variables':=binary()} diff --git a/mix.exs b/mix.exs index 6913836..3fc5795 100644 --- a/mix.exs +++ b/mix.exs @@ -15,6 +15,11 @@ defmodule Uinta.MixProject do homepage_url: @project_url, start_permanent: Mix.env() == :prod, deps: deps(), + dialyzer: [ + ignore_warnings: ".dialyzer.ignore-warnings", + list_unused_filters: true, + plt_add_apps: [:mix] + ], docs: docs(), package: package(), test_coverage: [summary: [threshold: 80]] @@ -30,6 +35,7 @@ defmodule Uinta.MixProject do defp deps do [ {:credo, "~> 1.7", only: [:dev, :test]}, + {:dialyxir, "~> 1.4", only: :dev, runtime: false}, {:ex_doc, "~> 0.30", only: :dev, runtime: false}, {:jason, "~> 1.4"}, {:plug, "~> 1.10", optional: true} diff --git a/mix.lock b/mix.lock index 0466e54..e40eda6 100644 --- a/mix.lock +++ b/mix.lock @@ -1,7 +1,9 @@ %{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "credo": {:hex, :credo, "1.7.5", "643213503b1c766ec0496d828c90c424471ea54da77c8a168c725686377b9545", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "f799e9b5cd1891577d8c773d245668aa74a2fcd15eb277f51a0131690ebfb3fd"}, + "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, + "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.31.2", "8b06d0a5ac69e1a54df35519c951f1f44a7b7ca9a5bb7a260cd8a174d6322ece", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "317346c14febaba9ca40fd97b5b5919f7751fb85d399cc8e7e8872049f37e0af"}, "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},