Skip to content

Commit

Permalink
chore: update code for more recent Credo defaults
Browse files Browse the repository at this point in the history
In particular, `AliasOrder` should have been the default before, but for
whatever reason in #167 it was set to `false`.
  • Loading branch information
paulswartz committed Dec 28, 2023
1 parent eb63356 commit 26fd18d
Show file tree
Hide file tree
Showing 23 changed files with 29 additions and 220 deletions.
189 changes: 0 additions & 189 deletions .credo.exs

This file was deleted.

6 changes: 3 additions & 3 deletions lib/concentrate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ defmodule Concentrate do
routes: {&is_list/1, & &1},
excluded_routes: {&is_list/1, & &1},
fallback_url: {&is_binary/1, & &1},
username: {&is_possible_env_var/1, &process_possible_env_var/1},
password: {&is_possible_env_var/1, &process_possible_env_var/1},
username: {&possible_env_var?/1, &process_possible_env_var/1},
password: {&possible_env_var?/1, &process_possible_env_var/1},
topics: {&is_list/1, & &1},
max_future_time: {&is_integer/1, & &1},
fetch_after: {&is_integer/1, & &1},
Expand Down Expand Up @@ -187,7 +187,7 @@ defmodule Concentrate do
Keyword.new(acc)
end

defp is_possible_env_var(value) do
defp possible_env_var?(value) do
case value do
%{"system" => _} -> true
<<_::binary>> -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ defmodule Concentrate.GroupFilter.RemoveUncertainStopTimeUpdates do
If no uncertainty values are configured, enabling this filter has no effect.
"""
alias Concentrate.TripDescriptor
alias Concentrate.StopTimeUpdate
alias Concentrate.{StopTimeUpdate, TripDescriptor}

@behaviour Concentrate.GroupFilter

Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/encoder/gtfs_realtime_helpers_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.Encoder.GTFSRealtimeHelpersTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.Encoder.GTFSRealtimeHelpers
alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition}

doctest Concentrate.Encoder.GTFSRealtimeHelpers

Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/encoder/trip_updates/json_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Concentrate.Encoder.TripUpdates.JSONTest do
use ExUnit.Case, async: true
import Concentrate.Encoder.TripUpdates.JSON
import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1]
alias Concentrate.{TripDescriptor, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor}

describe "encode_groups/1" do
test "same output as EncoderTripUpdates.encode_groups/1 but in JSON" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/encoder/trip_updates_enhanced_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Concentrate.Encoder.TripUpdatesEnhancedTest do
import Concentrate.Encoder.TripUpdatesEnhanced
import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1]
alias Concentrate.Parser.GTFSRealtimeEnhanced
alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition}

describe "encode_groups/1" do
test "decoding and re-encoding TripUpdates_enhanced.json is a no-op" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/encoder/trip_updates_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Concentrate.Encoder.TripUpdatesTest do
import Concentrate.TestHelpers
import Concentrate.Encoder.TripUpdates
import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1]
alias Concentrate.{FeedUpdate, TripDescriptor, VehiclePosition, StopTimeUpdate}
alias Concentrate.{FeedUpdate, StopTimeUpdate, TripDescriptor, VehiclePosition}
alias Concentrate.Parser.GTFSRealtime

describe "encode_groups/1" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/encoder/vehicle_positions_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Concentrate.Encoder.VehiclePositionsTest do
import Concentrate.TestHelpers
import Concentrate.Encoder.VehiclePositions
import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1]
alias Concentrate.{FeedUpdate, TripDescriptor, VehiclePosition, StopTimeUpdate}
alias Concentrate.{FeedUpdate, StopTimeUpdate, TripDescriptor, VehiclePosition}
alias Concentrate.Parser.GTFSRealtime

describe "encode/1" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/group_filter/cancelled_trip_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.CancelledTripTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.GroupFilter.CancelledTrip
alias Concentrate.{TripDescriptor, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor}

@module Concentrate.Filter.FakeCancelledTrips

Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/group_filter/closed_stop_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.ClosedStopTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.GroupFilter.ClosedStop
alias Concentrate.{TripDescriptor, StopTimeUpdate, VehiclePosition}
alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition}

@trip_update TripDescriptor.new(trip_id: "trip", direction_id: 1, route_id: "route")
@valid_date_time 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
defmodule Concentrate.GroupFilter.RemoveUncertainStopTimesTest do
use ExUnit.Case, async: true
alias Concentrate.GroupFilter.RemoveUncertainStopTimeUpdates
alias Concentrate.TripDescriptor
alias Concentrate.StopTimeUpdate
alias Concentrate.{StopTimeUpdate, TripDescriptor}

@mid_trip 60
@at_terminal 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.RemoveUnneededTimesTest do
@moduledoc false
use ExUnit.Case, async: true
alias Concentrate.GroupFilter.RemoveUnneededTimes
alias Concentrate.{TripDescriptor, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor}

defmodule FakeStopTimes do
@moduledoc "Fake implementation of GTFS.StopTimes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.ScheduledStopTimesTest do
@moduledoc false
use ExUnit.Case, async: true
alias Concentrate.GroupFilter.ScheduledStopTimes
alias Concentrate.{TripDescriptor, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor}

defmodule FakeStopTimes do
def arrival_departure("trip1", 10, {2022, 1, 1}), do: {1_610_000_000, 1_610_000_001}
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/group_filter/shuttle_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.GroupFilter.Shuttle
alias Concentrate.{TripDescriptor, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor}

@trip_id "trip"
@route_id "route"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.Filter.SkippedStopOnAddedTripTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.GroupFilter.SkippedStopOnAddedTrip
alias Concentrate.{TripDescriptor, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor}

@trip_id "trip"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.VehicleAtSkippedStopTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.GroupFilter.VehicleAtSkippedStop
alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition}

describe "filter/1" do
test "if the vehicle's stop_id is SKIPPED, change to the next stop" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/group_filter/vehicle_past_stop_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.VehiclePastStopTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.GroupFilter.VehiclePastStop
alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate}
alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition}

describe "filter/1" do
test "removes StopTimeUpdates if they come after the vehicle's sequence" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/group_filter/vehicle_stop_match_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ defmodule Concentrate.GroupFilter.VehicleStopMatchTest do
@moduledoc false
use ExUnit.Case, async: true
import Concentrate.GroupFilter.VehicleStopMatch
alias Concentrate.{StopTimeUpdate, VehiclePosition}
alias Concentrate.GTFS.Stops
alias Concentrate.{StopTimeUpdate, VehiclePosition}

describe "filter/1" do
test "updates the VehiclePosition stop_id to match the StopTimeUpdate" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/merge_filter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ defmodule Concentrate.MergeFilterTest do
use ExUnitProperties
import ExUnit.CaptureLog, only: [capture_log: 1]
import Concentrate.MergeFilter
alias Concentrate.{Merge, FeedUpdate, TripDescriptor, VehiclePosition, StopTimeUpdate}
alias Concentrate.Encoder.GTFSRealtimeHelpers
alias Concentrate.{FeedUpdate, Merge, StopTimeUpdate, TripDescriptor, VehiclePosition}

describe "handle_subscribe/4" do
test "lets GenStage manage the demand automatically" do
Expand Down
10 changes: 5 additions & 5 deletions test/concentrate/parser/gtfs_realtime_enhanced_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ defmodule Concentrate.Parser.GTFSRealtimeEnhancedTest do
import Concentrate.Parser.GTFSRealtimeEnhanced

alias Concentrate.{
FeedUpdate,
TripDescriptor,
StopTimeUpdate,
VehiclePosition,
Alert,
Alert.InformedEntity,
FeedUpdate,
Parser.Helpers,
Parser.Helpers.Options
Parser.Helpers.Options,
StopTimeUpdate,
TripDescriptor,
VehiclePosition
}

describe "parse/1" do
Expand Down
2 changes: 1 addition & 1 deletion test/concentrate/parser/gtfs_realtime_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Concentrate.Parser.GTFSRealtimeTest do
import ExUnit.CaptureLog
import Concentrate.TestHelpers
import Concentrate.Parser.GTFSRealtime
alias Concentrate.{FeedUpdate, VehiclePosition, TripDescriptor, StopTimeUpdate, Alert}
alias Concentrate.{Alert, FeedUpdate, StopTimeUpdate, TripDescriptor, VehiclePosition}
alias Concentrate.Parser.Helpers.Options

describe "parse/1" do
Expand Down
Loading

0 comments on commit 26fd18d

Please sign in to comment.