Skip to content

Commit 179b8dc

Browse files
authored
Bump dependencies, CI, and update Dialyzer
* Bump dependencies and test with latest Elixir * Fix deprecation warning when running tests * Update Dialyzer for latest Erlang; Fix most issues
1 parent 9719172 commit 179b8dc

File tree

7 files changed

+34
-28
lines changed

7 files changed

+34
-28
lines changed

.github/workflows/ci.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ jobs:
1313
otp: 25
1414
- elixir: 1.16
1515
otp: 26
16+
- elixir: 1.17
17+
otp: 27
18+
- elixir: 1.18
19+
otp: 27
1620
steps:
1721
- name: Cancel Previous Runs
1822
uses: styfle/cancel-workflow-action@0.11.0
@@ -59,10 +63,8 @@ jobs:
5963
strategy:
6064
matrix:
6165
include:
62-
- elixir: 1.15
63-
otp: 25
64-
- elixir: 1.16
65-
otp: 26
66+
- elixir: 1.18
67+
otp: 27
6668
steps:
6769
- name: Cancel Previous Runs
6870
uses: styfle/cancel-workflow-action@0.11.0
@@ -113,6 +115,10 @@ jobs:
113115
otp: 25
114116
- elixir: 1.16
115117
otp: 26
118+
- elixir: 1.17
119+
otp: 27
120+
- elixir: 1.18
121+
otp: 27
116122
steps:
117123
- name: Cancel Previous Runs
118124
uses: styfle/cancel-workflow-action@0.11.0
@@ -141,4 +147,4 @@ jobs:
141147
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
142148

143149
- name: Run test
144-
run: mix test --trace --slowest 10
150+
run: mix test --warnings-as-errors --trace --slowest 10

config/config.exs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import Config
22

3-
config :sgp40, transport_mod: SGP40.MockTransport
3+
if Mix.env() == :test do
4+
config :sgp40, transport_mod: SGP40.MockTransport
5+
end

lib/sgp40/comm.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ defmodule SGP40.Comm do
1010

1111
@transport_mod Application.compile_env(:sgp40, :transport_mod, SGP40.Transport.I2C)
1212

13-
@spec serial_id(pid) :: {:ok, binary}
13+
@spec serial_id(any) :: {:ok, binary} | {:error, any()}
1414
def serial_id(transport) do
1515
case @transport_mod.write_read(transport, @cmd_get_serial_id, 3) do
1616
{:ok, serial_id_binary} -> {:ok, Base.encode16(serial_id_binary)}
1717
error -> error
1818
end
1919
end
2020

21-
@spec featureset(any) :: {:ok, byte}
21+
@spec featureset(any) :: {:ok, byte} | {:error, any()}
2222
def featureset(transport) do
2323
case @transport_mod.write_read(transport, @cmd_get_featureset, 1) do
2424
{:ok, <<featureset>>} -> {:ok, featureset}
@@ -30,7 +30,7 @@ defmodule SGP40.Comm do
3030
Triggers the built-in self-test checking for integrity of both hotplate and MOX material and
3131
returns the result of this test as 2 bytes (+ 1 CRC byte).
3232
"""
33-
@spec measure_test(pid) :: {:ok, binary}
33+
@spec measure_test(pid) :: {:ok, binary} | {:error, any()}
3434
def measure_test(transport) do
3535
with :ok <- @transport_mod.write(transport, @cmd_measure_test),
3636
:ok <- Process.sleep(250),

lib/sgp40/voc_index.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule SGP40.VocIndex do
1414
Initialize the VOC algorithm parameters. Call this once at the beginning or
1515
whenever the sensor stopped measurements.
1616
"""
17-
@spec start_link(any) :: GenServer.on_start()
17+
@spec start_link(keyword()) :: GenServer.on_start()
1818
def start_link(_args \\ []) do
1919
case GenServer.start_link(__MODULE__, nil, name: __MODULE__) do
2020
{:ok, pid} -> {:ok, pid}

mix.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ defmodule SGP40.MixProject do
5050

5151
defp dialyzer() do
5252
[
53-
flags: [:race_conditions, :unmatched_returns, :error_handling, :underspecs]
53+
flags: [:missing_return, :extra_return, :unmatched_returns, :error_handling, :underspecs]
5454
]
5555
end
5656

mix.lock

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
%{
22
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
3-
"circuits_i2c": {:hex, :circuits_i2c, "2.0.2", "ed1bac41cca0b777e11e2105c08dc7cad67a221e0d7eec1680a644eba677f9f5", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "b8cf6ef783f9184bf4e45a1a4fa0a72523aa4e3c2fa980f94a45336c92d95178"},
4-
"credo": {:hex, :credo, "1.7.3", "05bb11eaf2f2b8db370ecaa6a6bda2ec49b2acd5e0418bc106b73b07128c0436", [: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", "35ea675a094c934c22fb1dca3696f3c31f2728ae6ef5a53b5d648c11180a4535"},
5-
"dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"},
6-
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
7-
"elixir_make": {:hex, :elixir_make, "0.7.8", "505026f266552ee5aabca0b9f9c229cbb496c689537c9f922f3eb5431157efc7", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "7a71945b913d37ea89b06966e1342c85cfe549b15e6d6d081e8081c493062c07"},
8-
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
9-
"ex_doc": {:hex, :ex_doc, "0.31.1", "8a2355ac42b1cc7b2379da9e40243f2670143721dd50748bf6c3b1184dae2089", [: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", "3178c3a407c557d8343479e1ff117a96fd31bafe52a039079593fb0524ef61b0"},
10-
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
11-
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
12-
"makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"},
13-
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
14-
"makeup_erlang": {:hex, :makeup_erlang, "0.1.3", "d684f4bac8690e70b06eb52dad65d26de2eefa44cd19d64a8095e1417df7c8fd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "b78dc853d2e670ff6390b605d807263bf606da3c82be37f9d7f68635bd886fc9"},
15-
"mix_test_watch": {:hex, :mix_test_watch, "1.1.1", "eee6fc570d77ad6851c7bc08de420a47fd1e449ef5ccfa6a77ef68b72e7e51ad", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "f82262b54dee533467021723892e15c3267349849f1f737526523ecba4e6baae"},
16-
"mox": {:hex, :mox, "1.1.0", "0f5e399649ce9ab7602f72e718305c0f9cdc351190f72844599545e4996af73c", [:mix], [], "hexpm", "d44474c50be02d5b72131070281a5d3895c0e7a95c780e90bc0cfe712f633a13"},
3+
"circuits_i2c": {:hex, :circuits_i2c, "2.0.6", "78f69c24e4dcc83cd6806e29810540dfb9f6686f290852e34cc020199efd6c7c", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "9b21289b5d350b6b64bf40ddd15d499ee5a04e6353d8de8bc839c615b555b96b"},
4+
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [: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", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"},
5+
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
6+
"earmark_parser": {:hex, :earmark_parser, "1.4.42", "f23d856f41919f17cd06a493923a722d87a2d684f143a1e663c04a2b93100682", [:mix], [], "hexpm", "6915b6ca369b5f7346636a2f41c6a6d78b5af419d61a611079189233358b8b8b"},
7+
"elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
8+
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
9+
"ex_doc": {:hex, :ex_doc, "0.36.1", "4197d034f93e0b89ec79fac56e226107824adcce8d2dd0a26f5ed3a95efc36b1", [:mix], [{:earmark_parser, "~> 1.4.42", [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", "d7d26a7cf965dacadcd48f9fa7b5953d7d0cfa3b44fa7a65514427da44eafd89"},
10+
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
11+
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
12+
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
13+
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
14+
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},
15+
"mix_test_watch": {:hex, :mix_test_watch, "1.2.0", "1f9acd9e1104f62f280e30fc2243ae5e6d8ddc2f7f4dc9bceb454b9a41c82b42", [:mix], [{:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "278dc955c20b3fb9a3168b5c2493c2e5cffad133548d307e0a50c7f2cfbf34f6"},
16+
"mox": {:hex, :mox, "1.2.0", "a2cd96b4b80a3883e3100a221e8adc1b98e4c3a332a8fc434c39526babafd5b3", [:mix], [{:nimble_ownership, "~> 1.0", [hex: :nimble_ownership, repo: "hexpm", optional: false]}], "hexpm", "c7b92b3cc69ee24a7eeeaf944cd7be22013c52fcb580c1f33f50845ec821089a"},
17+
"nimble_ownership": {:hex, :nimble_ownership, "1.0.1", "f69fae0cdd451b1614364013544e66e4f5d25f36a2056a9698b793305c5aa3a6", [:mix], [], "hexpm", "3825e461025464f519f3f3e4a1f9b68c47dc151369611629ad08b636b73bb22d"},
1718
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
1819
}

test/test_helper.exs

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
# Always warning as errors
2-
Code.put_compiler_option(:warnings_as_errors, true)
3-
41
ExUnit.start()

0 commit comments

Comments
 (0)