Skip to content

Commit 7d45f37

Browse files
authored
Merge pull request #6 from togethercomputer/tpfeiffer/eng-35165-add-dialyzer-to-elixir-common
Add dialyzer
2 parents 506ec7e + db5603e commit 7d45f37

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ jobs:
7171
restore-keys: |
7272
${{ runner.os }}-mix-
7373
74+
- name: Fetch PLT Cache
75+
uses: actions/cache@v4
76+
with:
77+
key: ${{ runner.os }}-plt-${{ hashFiles('mix.lock') }}
78+
restore-keys: |
79+
${{ runner.os }}-plt-
80+
path: |
81+
priv/plts
82+
7483
- name: Install
7584
run: |
7685
mix local.hex --force
@@ -88,3 +97,10 @@ jobs:
8897
- name: Check Credo
8998
run: mix credo
9099
if: always()
100+
101+
- name: Run Dialyzer
102+
# Two formats are included for ease of debugging and it is lightly recommended to use both, see https://github.com/jeremyjh/dialyxir/issues/530 for reasoning
103+
# --format github is helpful to print the warnings in a way that GitHub understands and can place on the /files page of a PR
104+
# --format dialyxir allows the raw GitHub actions logs to be useful because they have the full warning printed
105+
run: mix dialyzer --format github --format dialyxir
106+
if: always()

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ together-*.tar
2121

2222
# Temporary files, for example, from tests.
2323
/tmp/
24+
25+
# Dialyzer plt files
26+
/priv/plts/*.plt
27+
/priv/plts/*.plt.hash

mix.exs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ defmodule Together.MixProject do
1313
docs: docs(),
1414
name: "Together Elixir Common",
1515
source_url: "https://github.com/togethercomputer/elixir-common",
16-
homepage_url: "https://github.com/togethercomputer/elixir-common"
16+
homepage_url: "https://github.com/togethercomputer/elixir-common",
17+
18+
# Dialyzer
19+
dialyzer: [
20+
# Put the project-level PLT in the priv/ directory (instead of the default _build/ location)
21+
plt_file: {:no_warn, "priv/plts/project.plt"},
22+
plt_add_apps: [:ex_unit, :mix]
23+
]
1724
]
1825
end
1926

@@ -26,6 +33,7 @@ defmodule Together.MixProject do
2633
defp deps do
2734
[
2835
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
36+
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
2937
{:ecto, "~> 3.5", optional: true},
3038
{:ex_doc, "~> 0.38", only: [:dev], runtime: false}
3139
]

mix.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
33
"credo": {:hex, :credo, "1.7.12", "9e3c20463de4b5f3f23721527fcaf16722ec815e70ff6c60b86412c695d426c1", [: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", "8493d45c656c5427d9c729235b99d498bd133421f3e0a683e5c1b561471291e5"},
44
"decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"},
5+
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
56
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
67
"ecto": {:hex, :ecto, "3.13.0", "7528ef4f3a4cdcfebeb7eb6545806c8109529b385a69f701fc3d77b5b8bde6e7", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "061f095f1cc097f71f743b500affc792d6869df22b1946a73ab5495eb9b4a280"},
8+
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
79
"ex_doc": {:hex, :ex_doc, "0.38.2", "504d25eef296b4dec3b8e33e810bc8b5344d565998cd83914ffe1b8503737c02", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "732f2d972e42c116a70802f9898c51b54916e542cc50968ac6980512ec90f42b"},
810
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
911
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},

0 commit comments

Comments
 (0)