Skip to content

Commit

Permalink
line length, blank lines, and remove bench (#2118)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull authored Jun 27, 2024
1 parent 9f901f6 commit 4cc6b54
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 145 deletions.
64 changes: 0 additions & 64 deletions bench/alert_bench.exs

This file was deleted.

17 changes: 0 additions & 17 deletions bench/join_bench.exs

This file was deleted.

11 changes: 0 additions & 11 deletions bench/json_api_bench.exs

This file was deleted.

20 changes: 0 additions & 20 deletions bench/page_controller_bench.exs

This file was deleted.

2 changes: 1 addition & 1 deletion lib/dotcom_web/views/error_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ defmodule DotcomWeb.ErrorView do
# error_type: "Maintenance",
# error_title: "Service change in effect.",
# error_description: "This page is down for maintenance.",
# error_instructions: "Please check back after at least 24 hours, or try searching for what you're looking for below."
# error_instructions: "Please check back after at least 24 hours..."
# }))
# end

Expand Down
3 changes: 2 additions & 1 deletion lib/predicted_schedule/group.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ defmodule PredictedSchedule.Group do
# at the user selected stop.
# So, we filter the predictions so that they
# 1) either match up to the schedule pairs, or
# 2) we have two predictions with the same trip_id, and one of them is for the departure stop and the other for the destination.
# 2) we have two predictions with the same trip_id, and one of them is for the departure stop and the other
# for the destination.

@spec filter_relevant_predictions(
prediction_map_t,
Expand Down
50 changes: 23 additions & 27 deletions lib/stops/route_stop.ex
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
defmodule Stops.RouteStop do
@moduledoc """
A helper module for generating some contextual information about stops on a route. RouteStops contain
the following information:
```
# RouteStop info for South Station on the Red Line (direction_id: 0)
%Stops.RouteStop{
id: "place-sstat", # The id that the stop is typically identified by (i.e. the parent stop's id)
name: "South Station" # Stop's display name
zone: "1A" # Commuter rail zone (will be nil if stop doesn't have CR routes)
route: %Route{id: "Red"...} # The full Route for the parent route
branch: nil # Name of the branch that this stop is on for this route. will be nil unless the stop is actually on a branch.
station_info: %Stop{id: "place-sstat"...} # Full Stops.Stop struct for the parent stop.
stop_features: [:commuter_rail, :bus, :accessible] # List of atoms representing the icons that should be displayed for this stop.
terminus?: false # Whether this is either the first or last stop on the route.
}
```
A helper module for generating some contextual information about stops on a route.
"""

alias __MODULE__, as: RouteStop
Expand Down Expand Up @@ -44,17 +28,25 @@ defmodule Stops.RouteStop do
@type direction_id_t :: 0 | 1

@type t :: %__MODULE__{
# The id that the stop is typically identified by (i.e. the parent stop's id)
id: Stop.id_t(),
name: String.t(),
zone: String.t() | {:error, :not_fetched},
# Name of the branch that this stop is on for this route, if on one.
branch: branch_name_t,
station_info: Stop.t(),
route: Route.t() | nil,
closed_stop_info: Stop.ClosedStopInfo.t() | nil,
connections: [Route.t()] | {:error, :not_fetched},
is_beginning?: boolean,
# Stop's display name
name: String.t(),
# The full Route for the parent route
route: Route.t() | nil,
# Full Stops.Stop struct for the parent stop.
station_info: Stop.t(),
# Display icons.
stop_features: [Stops.Repo.Behaviour.stop_feature()] | {:error, :not_fetched},
# Whether this is either the first or last stop on the route.
terminus?: boolean,
is_beginning?: boolean,
closed_stop_info: Stop.ClosedStopInfo.t() | nil
# Commuter rail zone (will be nil if stop doesn't have CR routes)
zone: String.t() | {:error, :not_fetched}
}

def to_json_safe(%RouteStop{connections: connections, route: route} = map) do
Expand All @@ -66,7 +58,9 @@ defmodule Stops.RouteStop do
end

@doc """
Given a list of route patterns with stops and a route, generates a list of RouteStops representing all stops on that route. If the route has branches, the branched stops appear grouped together in order as part of the list.
Given a list of route patterns with stops and a route,
generates a list of RouteStops representing all stops on that route.
If the route has branches, the branched stops appear grouped together in order as part of the list.
"""
@spec list_from_route_patterns(
[{RoutePattern.t(), [Stop.t()]}],
Expand All @@ -90,7 +84,8 @@ defmodule Stops.RouteStop do
_direction_id,
use_route_id_for_branch_name?
) do
# If there is only one route pattern, we know that we won't need to deal with merging branches so we just return whatever the list of stops is without calling &merge_branch_list/2.
# If there is only one route pattern, we know that we won't need to deal with merging branches.
# We just return whatever the list of stops is without calling &merge_branch_list/2.
list_from_route_pattern(
route_pattern_with_stops,
route,
Expand Down Expand Up @@ -155,8 +150,9 @@ defmodule Stops.RouteStop do
defp branch_name(%RoutePattern{name: name}, false), do: name

@doc """
Given a route and a list of that route's shapes, generates a list of RouteStops representing all stops on that route. If the route has branches,
the branched stops appear grouped together in order as part of the list.
Given a route and a list of that route's shapes,
generates a list of RouteStops representing all stops on that route.
If the route has branches, the branched stops appear grouped together in order as part of the list.
"""
@spec list_from_shapes([Shape.t()], [Stop.t()], Route.t(), direction_id_t) ::
[RouteStop.t()]
Expand Down
6 changes: 4 additions & 2 deletions lib/telemetry/helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ defmodule Telemetry.Helper do
You can pass in a filter so that you only see telemetry events for a specific module.
E.g., if you want to see all telemetry events for Phoenix you can pass in `[:phoenix]`.
For more specific events you can pass in more specific names like `[:phoenix, :router_dispatch]` or `[:phoenix, :router_dispatch, :stop]`.
For more specific events you can pass in more specific names like `[:phoenix, :router_dispatch]`
or `[:phoenix, :router_dispatch, :stop]`.
"""
def attach(filter \\ nil) do
# Start the tracer
:dbg.start()

# Create tracer process with a function that pattern matches out the three arguments the telemetry calls are made with.
# Create tracer process with a function that pattern matches out the three arguments the
# telemetry calls are made with.
:dbg.tracer(
:process,
{
Expand Down
1 change: 0 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ defmodule DotCom.Mixfile do
defp deps do
[
{:absinthe_client, "0.1.0"},
{:benchfella, "0.3.5", [only: :dev]},
# latest version 1.0.7; cannot upgrade because of server_sent_event_stage expects castore < 1
{:castore, "0.1.22"},
{:crc, "0.10.5"},
Expand Down
1 change: 0 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
%{
"absinthe_client": {:hex, :absinthe_client, "0.1.0", "a3bafc1dff141073a2a7fd926942fb10afb4d45295f0b6df46f6f1955ececaac", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:req, "~> 0.3.0", [hex: :req, repo: "hexpm", optional: false]}, {:slipstream, "~> 1.0", [hex: :slipstream, repo: "hexpm", optional: false]}], "hexpm", "a7ec3e13da9b463cb024dba4733c2fa31a0690a3bfa897b9df6bdd544a4d6f91"},
"benchfella": {:hex, :benchfella, "0.3.5", "b2122c234117b3f91ed7b43b6e915e19e1ab216971154acd0a80ce0e9b8c05f5", [:mix], [], "hexpm", "23f27cbc482cbac03fc8926441eb60a5e111759c17642bac005c3225f5eb809d"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"castore": {:hex, :castore, "0.1.22", "4127549e411bedd012ca3a308dede574f43819fe9394254ca55ab4895abfa1a2", [:mix], [], "hexpm", "c17576df47eb5aa1ee40cc4134316a99f5cad3e215d5c77b8dd3cfef12a22cac"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
Expand Down

0 comments on commit 4cc6b54

Please sign in to comment.