Skip to content

Commit a192791

Browse files
authored
Add Dialyzer (#3)
1 parent b65347a commit a192791

File tree

5 files changed

+46
-25
lines changed

5 files changed

+46
-25
lines changed

.credo.exs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@
8989
priority: :low,
9090
if_nested_deeper_than: 2,
9191
if_called_more_often_than: 0,
92-
files: %{
93-
excluded: [
94-
~r"/lib/dashfloat_web/components/form_components.ex"
95-
]
96-
}
9792
]},
9893
{Credo.Check.Design.SkipTestWithoutComment, []},
9994
# You can also customize the exit_status of each check.
@@ -108,15 +103,7 @@
108103
#
109104
{Credo.Check.Readability.AliasOrder, []},
110105
{Credo.Check.Readability.FunctionNames, []},
111-
{Credo.Check.Readability.ImplTrue,
112-
[
113-
files: %{
114-
excluded: [
115-
~r"/lib/dashfloat/application.ex",
116-
~r"/lib/dashfloat_web/live/"
117-
]
118-
}
119-
]},
106+
{Credo.Check.Readability.ImplTrue, []},
120107
{Credo.Check.Readability.LargeNumbers, []},
121108
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
122109
{Credo.Check.Readability.ModuleAttributeNames, []},
@@ -135,17 +122,7 @@
135122
{Credo.Check.Readability.SeparateAliasRequire, []},
136123
{Credo.Check.Readability.SinglePipe, []},
137124
{Credo.Check.Readability.SpaceAfterCommas, []},
138-
{Credo.Check.Readability.Specs,
139-
[
140-
files: %{
141-
excluded: [
142-
~r"/lib/dashfloat/contexts/budgeting/policies/checks/",
143-
~r"/lib/dashfloat_web/components/",
144-
~r"/lib/dashfloat_web/controllers/",
145-
~r"/lib/dashfloat_web/live/"
146-
]
147-
}
148-
]},
125+
{Credo.Check.Readability.Specs, []},
149126
{Credo.Check.Readability.StrictModuleLayout, []},
150127
{Credo.Check.Readability.StringSigils, []},
151128
{Credo.Check.Readability.TrailingBlankLine, []},

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,37 @@ jobs:
6565
- name: Run Linter
6666
run: mix lint.ci
6767

68+
- name: Restore PLT cache
69+
id: plt_cache
70+
uses: actions/cache/restore@v3
71+
with:
72+
key: |
73+
plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
74+
restore-keys: |
75+
plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-
76+
path: |
77+
priv/plts
78+
79+
# Create PLTs if no cache was found
80+
- name: Create PLTs
81+
if: steps.plt_cache.outputs.cache-hit != 'true'
82+
run: mix dialyzer --plt
83+
84+
# By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
85+
# so we separate the cache restore and save steps in case running dialyzer fails.
86+
- name: Save PLT cache
87+
id: plt_cache_save
88+
uses: actions/cache/save@v3
89+
if: steps.plt_cache.outputs.cache-hit != 'true'
90+
with:
91+
key: |
92+
plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
93+
path: |
94+
priv/plts
95+
96+
- name: Run Dialyzer
97+
run: mix dialyzer --format github
98+
6899
- name: Run Tests
69100
run: mix coveralls.json
70101

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ leetcode-*.tar
2424

2525
# Temporary files, for example, from tests.
2626
/tmp/
27+
28+
/priv/plts/*.plt
29+
/priv/plts/*.plt.hash

mix.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ defmodule LeetCodePractice.MixProject do
1616
"coveralls.post": :test,
1717
"coveralls.html": :test,
1818
"coveralls.cobertura": :test
19+
],
20+
dialyzer: [
21+
plt_add_apps: [
22+
:ex_unit
23+
],
24+
plt_file: {:no_warn, "priv/plts/project.plt"},
25+
list_unused_filters: true
1926
]
2027
]
2128
end
@@ -31,6 +38,7 @@ defmodule LeetCodePractice.MixProject do
3138
defp deps do
3239
[
3340
{:credo, "1.7.0", only: [:dev, :test], runtime: false},
41+
{:dialyxir, "1.4.2", only: [:dev, :test], runtime: false},
3442
{:excoveralls, "0.18.0", only: :test}
3543
]
3644
end

mix.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
%{
22
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
33
"credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "6839fcf63d1f0d1c0f450abc8564a57c43d644077ab96f2934563e68b8a769d7"},
4+
"dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"},
5+
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
46
"excoveralls": {:hex, :excoveralls, "0.18.0", "b92497e69465dc51bc37a6422226ee690ab437e4c06877e836f1c18daeb35da9", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1109bb911f3cb583401760be49c02cbbd16aed66ea9509fc5479335d284da60b"},
57
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
68
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},

0 commit comments

Comments
 (0)