Skip to content

Commit

Permalink
chore: Elixir 1.16.3
Browse files Browse the repository at this point in the history
Also updates Erlang and Alpine Linux to compatible patch versions. Updates usage of the :warn logger
level to :warning as well as dependencies that were still using :warn, causing compiler warnings.
Removes benchwarmer because it's not compatible with Elixir 1.16.3.
  • Loading branch information
bklebe committed Jun 6, 2024
1 parent 0a1da10 commit b3fc38f
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
elixir 1.14.5-otp-25
elixir 1.16.3-otp-25
erlang 25.3.2.12
python 3.9.16
poetry 1.7.0
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG ELIXIR_VERSION=1.14.5
ARG ERLANG_VERSION=25.3.2.7
ARG ALPINE_VERSION=3.17.5
ARG ERLANG_VERSION=25.3.2.12
ARG ALPINE_VERSION=3.17.7
ARG ELIXIR_VERSION=1.16.3

FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-alpine-${ALPINE_VERSION} as builder

Expand Down
2 changes: 1 addition & 1 deletion apps/alb_monitor/lib/alb_monitor/monitor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ defmodule ALBMonitor.Monitor do
end
end

defp log_warn(message) when is_binary(message), do: Logger.warn(["alb_monitor ", message])
defp log_warn(message) when is_binary(message), do: Logger.warning(["alb_monitor ", message])
defp log_info(message) when is_binary(message), do: Logger.info(["alb_monitor ", message])

defp schedule_check(%State{check_interval: check_interval}) do
Expand Down
4 changes: 3 additions & 1 deletion apps/api_accounts/lib/api_accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ defmodule ApiAccounts do
def totp_uri(%User{} = user) do
host = System.get_env("HOST")

NimbleTOTP.otpauth_uri("MBTA-API: #{host}/#{user.email}", user.totp_secret_bin, issuer: "MBTA")
NimbleTOTP.otpauth_uri("MBTA-API: #{host}/#{user.email}", user.totp_secret_bin,
issuer: "MBTA"
)
end
end
2 changes: 1 addition & 1 deletion apps/api_accounts/test/api_accounts/user_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ defmodule ApiAccounts.UserTest do
result = User.register(%User{}, @register_params)
assert result.changes.password != @register_params.password
assert result.valid?
assert Bcrypt.check_pass(@register_params.password, result.changes.password)
assert Bcrypt.verify_pass(@register_params.password, result.changes.password)
end
end

Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ config :recaptcha,
secret: "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe"

# Print only warnings and errors during test
config :logger, level: :warn
config :logger, level: :warning
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@

<.form_group form={f} field={:password_confirmation}>
<%= label(f, :password_confirmation, class: "control-label") %>
<%= password_input(f, :password_confirmation, class: "form-control", autocomplete: "off") %>
<%= password_input(f, :password_confirmation,
class: "form-control",
autocomplete: "off"
) %>
<%= error_tag(f, :password_confirmation) %>
</.form_group>

Expand Down
1 change: 0 additions & 1 deletion apps/api_web/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ defmodule ApiWeb.Mixfile do
{:api_accounts, in_umbrella: true},
{:memcachex, "~> 0.5"},
{:ehmon, github: "mbta/ehmon", branch: "master", only: :prod},
{:benchwarmer, "~> 0.0", only: [:dev, :test]},
{:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false},
{:logster, "~> 1.1"},
{:phoenix_swagger, "~> 0.8"},
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ excludes = [:integration]

# try to connect to memcache: if it fails, don't run those tests
excludes =
case :gen_tcp.connect('localhost', 11_211, [:inet], 100) do
case :gen_tcp.connect(~c"localhost", 11_211, [:inet], 100) do
{:ok, sock} ->
:gen_tcp.close(sock)
excludes
Expand Down
6 changes: 3 additions & 3 deletions apps/fetch/lib/fetch/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule Fetch.Worker do

def handle_info(message, state) do
_ =
Logger.warn(fn ->
Logger.warning(fn ->
# no cover
"unexpected message to Fetch.Worker[#{state.url}]: #{inspect(message)}"
end)
Expand Down Expand Up @@ -200,7 +200,7 @@ defmodule Fetch.Worker do
end

defp logger_with_level_for_error({:error, %HTTPoison.Error{reason: :timeout}}),
do: &Logger.warn/1
do: &Logger.warning/1

defp logger_with_level_for_error(_), do: &Logger.error/1

Expand Down Expand Up @@ -231,7 +231,7 @@ defmodule Fetch.Worker do
:ok

{:error, posix} ->
_ = Logger.warn("Error while writing #{cache_file}: #{inspect(posix)}")
_ = Logger.warning("Error while writing #{cache_file}: #{inspect(posix)}")
:ok
end
end
Expand Down
2 changes: 1 addition & 1 deletion apps/health/test/health/checkers/run_queue_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Health.Checkers.RunQueueTest do
end

test "does nothing when the log level is high" do
assert log_processes(false, :warn) == :ignored
assert log_processes(false, :warning) == :ignored
end
end

Expand Down
6 changes: 3 additions & 3 deletions apps/parse/lib/parse/commuter_rail_occupancies.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule Parse.CommuterRailOccupancies do
Enum.flat_map(data, &parse_record/1)

e ->
Logger.warn("#{__MODULE__} decode_error e=#{inspect(e)}")
Logger.warning("#{__MODULE__} decode_error e=#{inspect(e)}")
[]
end
end
Expand All @@ -38,13 +38,13 @@ defmodule Parse.CommuterRailOccupancies do
]
else
error ->
Logger.warn("#{__MODULE__} parse_error error=#{inspect(error)} #{inspect(record)}")
Logger.warning("#{__MODULE__} parse_error error=#{inspect(error)} #{inspect(record)}")
[]
end
end

defp parse_record(record) do
Logger.warn("#{__MODULE__} parse_error error=missing_fields #{inspect(record)}")
Logger.warning("#{__MODULE__} parse_error error=missing_fields #{inspect(record)}")
[]
end

Expand Down
2 changes: 1 addition & 1 deletion apps/state/bench/server.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule State.ServerBench do
Application.ensure_all_started(:mnesia)
State.Schedule.start_link
State.Schedule.new_state(@items)
Logger.configure(level: :warn)
Logger.configure(level: :warning)
{:ok, :ignored}
end

Expand Down
2 changes: 1 addition & 1 deletion apps/state/lib/logger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule State.Logger do
@doc """
Measures time of `function` and logs
"""
@spec debug_time(measured :: (() -> result), message :: (milliseconds :: float -> String.t())) ::
@spec debug_time(measured :: (-> result), message :: (milliseconds :: float -> String.t())) ::
result
when result: any
def debug_time(measured, message) when is_function(measured, 0) and is_function(message, 1) do
Expand Down
2 changes: 1 addition & 1 deletion apps/state/lib/state/facility.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule State.Facility do
optional(:types) => [String.t()]
}

@type facility_search :: (() -> [Facility.t()])
@type facility_search :: (-> [Facility.t()])

# If you change this list, be sure to also update the gtfs-documentation
@facility_types ~w(
Expand Down
2 changes: 1 addition & 1 deletion apps/state/lib/state/stop.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule State.Stop do
optional(:route_types) => [Model.Route.route_type()]
}

@type stop_search :: (() -> [Stop.t()])
@type stop_search :: (-> [Stop.t()])

def start_link(_opts \\ []) do
Supervisor.start_link(__MODULE__, nil, name: __MODULE__)
Expand Down
2 changes: 1 addition & 1 deletion apps/state/test/state/routes_by_service_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule State.RoutesByServiceTest do
update!()

on_exit(fn ->
Logger.configure(level: :warn)
Logger.configure(level: :warning)
end)
end

Expand Down
2 changes: 1 addition & 1 deletion apps/state_mediator/lib/state_mediator/mediator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ defmodule StateMediator.Mediator do
end)
end

defp logger_with_level_for_error(%HTTPoison.Error{reason: :timeout}), do: &Logger.warn/1
defp logger_with_level_for_error(%HTTPoison.Error{reason: :timeout}), do: &Logger.warning/1
defp logger_with_level_for_error(_), do: &Logger.error/1

@spec expand_url(String.t() | {module(), atom(), [any()]}) :: String.t()
Expand Down
2 changes: 1 addition & 1 deletion apps/state_mediator/test/gtfs_decompress_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule GtfsDecompressTest do
{to_charlist(filename), body(filename)}
end

{:ok, {_, body}} = :zip.create('GTFS.zip', file_list, [:memory])
{:ok, {_, body}} = :zip.create(~c"GTFS.zip", file_list, [:memory])
body
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule StateMediator.Integration.GtfsTest do
receive_items(State.RoutesPatternsAtStop)
receive_items(State.Shape)
receive_items(State.StopsOnRoute)
Logger.configure(level: :warn)
Logger.configure(level: :warning)
end

defp maybe_start_lasso!(nil) do
Expand Down
2 changes: 1 addition & 1 deletion apps/state_mediator/test/state_mediator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule StateMediatorTest do

test "returns environment value when set set" do
expected = "config_b"
:os.putenv('FAKE_VAR_B', String.to_charlist(expected))
:os.putenv(~c"FAKE_VAR_B", String.to_charlist(expected))
assert StateMediator.source_url(State.FakeModuleB) == expected
end

Expand Down
Loading

0 comments on commit b3fc38f

Please sign in to comment.