Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
elixir 1.17.3-otp-27
erlang 27.3.4.13
elixir 1.19.5-otp-28
erlang 28.5.0.3
python 3.9.16
poetry 1.7.0
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG ELIXIR_VERSION=1.17.3
ARG ERLANG_VERSION=27.3.4.13
ARG ELIXIR_VERSION=1.19.5
ARG ERLANG_VERSION=28.5.0.3
ARG ALPINE_VERSION=3.21.7

FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-alpine-${ALPINE_VERSION} as builder
Expand Down
2 changes: 1 addition & 1 deletion apps/api_accounts/lib/api_accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ defmodule ApiAccounts do
def auto_approve_key?(%User{} = user) do
# if there are no other keys, approve this one
user
|> list_keys_for_user
|> list_keys_for_user()
|> Enum.empty?()
end

Expand Down
6 changes: 3 additions & 3 deletions apps/api_accounts/lib/api_accounts/table.ex
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,19 @@ defmodule ApiAccounts.Table do

@doc false
def __before_compile__(env) do
unless Module.get_attribute(env.module, :struct_fields) do
if !Module.get_attribute(env.module, :struct_fields) do
raise ArgumentError,
"module #{inspect(env.module)} uses ApiAccounts.Table but it " <>
"does not define a table."
end

unless Module.get_attribute(env.module, :primary_key) do
if !Module.get_attribute(env.module, :primary_key) do
raise ArgumentError,
"module #{inspect(env.module)} uses ApiAccounts.Table but it " <>
"does not define a primary key. Refer to ApiAccounts.Table.field/3."
end

unless Module.get_attribute(env.module, :schema_version) do
if !Module.get_attribute(env.module, :schema_version) do
raise ArgumentError,
"module #{inspect(env.module)} uses ApiAccounts.Table but it " <>
"does not define a schema version. Refer to " <>
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/lib/api_web/api_controller_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ defmodule ApiWeb.ApiControllerHelpers do
defp do_filter_valid_field_attributes(conn, {type, fields}) do
view_module = view_module_for_type(type)

attr_filter = fn attr -> conn |> view_module.attribute_set |> MapSet.member?(attr) end
attr_filter = fn attr -> conn |> view_module.attribute_set() |> MapSet.member?(attr) end

fields
|> String.split(",")
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/lib/api_web/api_view_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule ApiWeb.ApiViewHelpers do

builder
|> JaSerializer.Formatter.format()
|> log_record_count
|> log_record_count()
end

defp log_record_count(%{"data" => list} = data) when is_list(list) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defmodule ApiWeb.Admin.Accounts.KeyController do
key_params =
key_params
|> Map.put(:rate_request_pending, false)
|> handle_per_minute
|> handle_per_minute()

key = ApiAccounts.get_key!(key_id)
user = conn.assigns.user
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/lib/api_web/controllers/line_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defmodule ApiWeb.LineController do
case filtered do
%{"id" => ids} ->
ids
|> split_on_comma
|> split_on_comma()
|> State.Line.by_ids()

_ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ defmodule ApiWeb.LiveFacilityController do

defp do_index_data(ids, conn, params) do
ids
|> split_on_comma
|> split_on_comma()
|> State.Facility.Parking.by_facility_ids()
|> Enum.group_by(& &1.facility_id)
|> Enum.map(fn {facilty_id, properties} ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ defmodule ApiWeb.ScheduleController do
end

def populate_extra_times(map, %{assigns: %{api_version: ver}}) when ver < "2019-07-01" do
for s <- map do
for %Model.Schedule{} = s <- map do
s = if s.pickup_type == 1, do: %Model.Schedule{s | departure_time: s.arrival_time}, else: s
if s.drop_off_type == 1, do: %Model.Schedule{s | arrival_time: s.departure_time}, else: s
end
Expand Down
4 changes: 2 additions & 2 deletions apps/api_web/lib/api_web/plugs/modified_since_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ defmodule ApiWeb.Plugs.ModifiedSinceHandler do

if Application.compile_env(:api_web, __MODULE__)[:check_caller] do
defp ensure_caller_defined(opts) do
unless opts[:caller] do
if !opts[:caller] do
raise ArgumentError, "expected `:caller` to be provided with module"
end
end

defp ensure_state_module_implemented(opts) do
unless opts[:caller].module_info(:exports)[:state_module] == 0 do
if opts[:caller].module_info(:exports)[:state_module] != 0 do
raise ArgumentError,
"expected `:caller` to implement " <>
"`state_module/0` and return a module from the " <> "`State` namespace"
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/lib/api_web/plugs/validate_date.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule ApiWeb.Plugs.ValidateDate do

def call(%Conn{query_params: query_params} = conn, []) do
query_params
|> get_date
|> get_date()
|> validate_date(conn)
end

Expand Down
4 changes: 2 additions & 2 deletions apps/api_web/lib/api_web/swagger_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ defmodule ApiWeb.SwaggerHelpers do
"""
def path(controller, action) do
controller
|> path_fn
|> path_fn()
|> call_path(action)
end

Expand All @@ -320,7 +320,7 @@ defmodule ApiWeb.SwaggerHelpers do

short_name =
module
|> to_string
|> to_string()
|> String.split(".")
|> List.last()
|> String.replace_suffix("Controller", "")
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/lib/api_web/views/facility_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defmodule ApiWeb.FacilityView do
properties =
facility.id
|> State.Facility.Property.by_facility_id()
|> encode_properties
|> encode_properties()

Map.put(attrs, :properties, properties)
else
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/lib/date_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defmodule DateHelpers do

def add_seconds_to_date(%Date{} = date, seconds) do
date
|> unix_midnight_seconds
|> unix_midnight_seconds()
|> add_seconds_to_date(seconds)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ defmodule ApiWeb.Portal.UserControllerTest do
setup %{conn: conn} do
{:ok, user_disabled} = ApiAccounts.create_user(%{email: "nofa@example.com"})

{:ok, conn: conn |> conn_with_session |> conn_with_user(user_disabled)}
{:ok, conn: conn |> conn_with_session() |> conn_with_user(user_disabled)}
end

test "configure 2fa with user with no 2fa", %{conn: conn} do
Expand Down Expand Up @@ -385,7 +385,7 @@ defmodule ApiWeb.Portal.UserControllerTest do
time: time
)

{:ok, conn: conn |> conn_with_session |> conn_with_user(user_enabled)}
{:ok, conn: conn |> conn_with_session() |> conn_with_user(user_enabled)}
end

test "configure 2fa with user with 2fa", %{conn: conn} do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,10 @@ defmodule ApiWeb.StopControllerTest do
stop2 = %Stop{id: "2"}
State.Stop.new_state([stop, stop2])

State.Route.new_state([%Model.Route{id: "route", type: 2}, %Model.Route{id: "other", type: 4}])
State.Route.new_state([
%Model.Route{id: "route", type: 2},
%Model.Route{id: "other", type: 4}
])

State.Trip.new_state([
%Model.Trip{id: "trip", route_id: "route", direction_id: 1},
Expand Down
2 changes: 1 addition & 1 deletion apps/api_web/test/api_web/plugs/deadline_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule ApiWeb.Plugs.DeadlineTest do
assert :ok =
conn
|> set(5_000)
|> check!
|> check!()
end

test "returns :ok if no deadline was set", %{conn: conn} do
Expand Down
4 changes: 2 additions & 2 deletions apps/health/lib/health/checker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ defmodule Health.Checker do

def current do
:current
|> each_checker
|> each_checker()
|> Enum.reduce([], &Keyword.merge/2)
end

def healthy? do
:healthy?
|> each_checker
|> each_checker()
|> Enum.all?()
end

Expand Down
32 changes: 16 additions & 16 deletions apps/parse/lib/parse/alerts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule Parse.Alerts do
for alert <- alert_json(json_map), active?(alert) do
alert
|> parse_alert()
|> cleanup_description
|> cleanup_description()
end
end

Expand Down Expand Up @@ -2712,24 +2712,24 @@ defmodule Parse.Alerts do
id: Map.get(alert, "id"),
effect: "PARKING_ISSUE",
cause: cause(alert),
header: alert |> Map.get("header_text") |> translated_text,
short_header: alert |> Map.get("short_header_text") |> translated_text,
description: alert |> Map.get("description_text") |> translated_text,
header: alert |> Map.get("header_text") |> translated_text(),
short_header: alert |> Map.get("short_header_text") |> translated_text(),
description: alert |> Map.get("description_text") |> translated_text(),
banner: alert |> Map.get("banner_text") |> translated_text(default: nil),
severity: Map.get(alert, "severity"),
created_at: alert |> Map.get("created_timestamp") |> unix_timestamp,
updated_at: alert |> Map.get("last_modified_timestamp") |> unix_timestamp,
created_at: alert |> Map.get("created_timestamp") |> unix_timestamp(),
updated_at: alert |> Map.get("last_modified_timestamp") |> unix_timestamp(),
active_period:
alert
|> Map.get("active_period", [])
|> fallback_active_period()
|> Enum.map(&active_period/1),
informed_entity:
Enum.map(Map.get(alert, "informed_entity") ++ added_informed_entities, &informed_entity/1),
service_effect: alert |> Map.get("service_effect_text") |> translated_text,
service_effect: alert |> Map.get("service_effect_text") |> translated_text(),
timeframe: alert |> Map.get("timeframe_text") |> translated_text(default: nil),
duration_certainty: alert |> Map.get("duration_certainty"),
lifecycle: alert |> Map.get("alert_lifecycle") |> lifecycle,
lifecycle: alert |> Map.get("alert_lifecycle") |> lifecycle(),
url: alert |> Map.get("url") |> translated_text(default: nil),
image: alert |> Map.get("image") |> translated_image(default: nil),
image_alternative_text:
Expand All @@ -2746,25 +2746,25 @@ defmodule Parse.Alerts do
id: Map.get(alert, "id"),
# Backwards compatability-can change to `translated_text` after all instances of
# alerts manager are returning a translated string
effect: alert |> Map.get("effect_detail") |> maybe_translated_text,
effect: alert |> Map.get("effect_detail") |> maybe_translated_text(),
cause: cause(alert),
header: alert |> Map.get("header_text") |> translated_text,
short_header: alert |> Map.get("short_header_text") |> translated_text,
description: alert |> Map.get("description_text") |> translated_text,
header: alert |> Map.get("header_text") |> translated_text(),
short_header: alert |> Map.get("short_header_text") |> translated_text(),
description: alert |> Map.get("description_text") |> translated_text(),
banner: alert |> Map.get("banner_text") |> translated_text(default: nil),
severity: Map.get(alert, "severity"),
created_at: alert |> Map.get("created_timestamp") |> unix_timestamp,
updated_at: alert |> Map.get("last_modified_timestamp") |> unix_timestamp,
created_at: alert |> Map.get("created_timestamp") |> unix_timestamp(),
updated_at: alert |> Map.get("last_modified_timestamp") |> unix_timestamp(),
active_period:
alert
|> Map.get("active_period", [])
|> fallback_active_period()
|> Enum.map(&active_period/1),
informed_entity: alert |> Map.get("informed_entity") |> Enum.map(&informed_entity/1),
service_effect: alert |> Map.get("service_effect_text") |> translated_text,
service_effect: alert |> Map.get("service_effect_text") |> translated_text(),
timeframe: alert |> Map.get("timeframe_text") |> translated_text(default: nil),
duration_certainty: alert |> Map.get("duration_certainty"),
lifecycle: alert |> Map.get("alert_lifecycle") |> lifecycle,
lifecycle: alert |> Map.get("alert_lifecycle") |> lifecycle(),
url: alert |> Map.get("url") |> translated_text(default: nil),
image: alert |> Map.get("image") |> translated_image(default: nil),
image_alternative_text:
Expand Down
4 changes: 2 additions & 2 deletions apps/parse/lib/parse/stop_times.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ defmodule Parse.StopTimes do
defp parse_rows(rows, nil) do
rows
|> Enum.map(&parse_row/1)
|> position_first_row
|> position_last_row
|> position_first_row()
|> position_last_row()
end

defp parse_rows([%{"trip_id" => trip_id} | _] = rows, trip_fn) do
Expand Down
2 changes: 1 addition & 1 deletion apps/parse/lib/parse/vehicle_positions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Parse.VehiclePositions do
# gzip encoded
blob
|> :zlib.gunzip()
|> parse
|> parse()
end

def parse("{" <> _ = blob) do
Expand Down
2 changes: 1 addition & 1 deletion apps/parse/lib/simple_csv.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule SimpleCSV do
"""
def decode(lines) do
lines
|> stream
|> stream()
|> Enum.to_list()
end

Expand Down
6 changes: 3 additions & 3 deletions apps/parse/test/parse/stop_times_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule Parse.StopTimesTest do
end

test "parse: parses a CSV blob into a list of stops, tagging the first stop", %{blob: blob} do
assert blob |> parse |> Enum.sort() == [
assert blob |> parse() |> Enum.sort() == [
%Schedule{
trip_id: "29063613",
stop_id: "2300",
Expand Down Expand Up @@ -61,7 +61,7 @@ defmodule Parse.StopTimesTest do
"29063613","14:36:00","14:36:01","2300","6","","1","1","1"\r
"""

assert blob |> parse |> Enum.to_list() == [
assert blob |> parse() |> Enum.to_list() == [
%Schedule{
trip_id: "29063613",
stop_id: "2300",
Expand All @@ -79,7 +79,7 @@ defmodule Parse.StopTimesTest do

test "if given a fn which returns a trip, only returns schedules which match and includes the route_id",
%{blob: blob} do
all_schedules = blob |> parse |> Enum.sort()
all_schedules = blob |> parse() |> Enum.sort()

assert blob
|> parse(fn trip_id ->
Expand Down
4 changes: 2 additions & 2 deletions apps/state/lib/state/alert/filter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule State.Alert.Filter do
@spec filter_by(Alert.filter_opts()) :: [Model.Alert.t()]
def filter_by(filter_opts) do
filter_opts
|> filter_to_list_of_ids
|> filter_to_list_of_ids()
|> filter_by_ids(filter_opts)
|> filter_by_informed_entity_activity(filter_opts)
|> filter_by_active_period(filter_opts)
Expand All @@ -32,7 +32,7 @@ defmodule State.Alert.Filter do
defp build_matchers(filter_opts) do
filter_opts
|> Enum.reduce([%{}], &do_build_matcher/2)
|> reject_empty_matchers
|> reject_empty_matchers()
|> Enum.uniq()
end

Expand Down
2 changes: 1 addition & 1 deletion apps/state/lib/state/alert/informed_entity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ defmodule State.Alert.InformedEntity do
facility: facility
}
end
|> reject_empty_parts
|> reject_empty_parts()
end

defp part_values(map, key) do
Expand Down
2 changes: 1 addition & 1 deletion apps/state/lib/state/prediction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defmodule State.Prediction do
case Map.get(prediction, time_key) do
%DateTime{} = dt ->
dt
|> service_date
|> service_date()
|> Kernel.==(date)

nil ->
Expand Down
Loading
Loading