Skip to content

Commit

Permalink
refactor: address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-willis-arcadis committed Nov 18, 2024
1 parent d930b01 commit 9fbdaa9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public enum NewGTFSErrorType {
FREQUENCY_PERIOD_OVERLAP(Priority.MEDIUM, "A frequency for a trip overlaps with another frequency defined for the same trip."),
ILLEGAL_FIELD_VALUE(Priority.MEDIUM, "Fields may not contain tabs, carriage returns or new lines."),
INTEGER_FORMAT(Priority.MEDIUM, "Incorrect integer format."),
INVALID_ARRIVAL_TIME(Priority.MEDIUM, "Arrival time at current stop is equal to the previous stop, which is impossible."),
LANGUAGE_FORMAT(Priority.LOW, "Language should be specified with a valid BCP47 tag."),
MISSING_ARRIVAL_OR_DEPARTURE(Priority.MEDIUM, "First and last stop times are required to have both an arrival and departure time."),
MISSING_COLUMN(Priority.MEDIUM, "A required column was missing from a table."),
Expand All @@ -44,6 +43,7 @@ public enum NewGTFSErrorType {
NUMBER_TOO_SMALL(Priority.MEDIUM, "Number was below the allowed range."),
OVERLAPPING_TRIP(Priority.MEDIUM, "Blocks?"),
REFERENTIAL_INTEGRITY(Priority.HIGH, "This line references an ID that does not exist in the target table."),
REPEATED_ARRIVAL_TIME(Priority.MEDIUM, "Arrival time at current stop is equal to the previous stop."),
REQUIRED_TABLE_EMPTY(Priority.MEDIUM, "This table is required by the GTFS specification but is empty."),
ROUTE_DESCRIPTION_SAME_AS_NAME(Priority.LOW, "The description of a route is identical to its name, so does not add any information."),
ROUTE_LONG_NAME_CONTAINS_SHORT_NAME(Priority.LOW, "The long name of a route should complement the short name, not include it."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void validateTrip(Trip trip, Route route, List<StopTime> stopTimes, List<
StopTime currStopTime = stopTimes.get(i);
// Additional check: Ensure arrival_time is not the same for consecutive stops
if (currStopTime.arrival_time == prevStopTime.arrival_time) {
registerError(currStopTime, NewGTFSErrorType.INVALID_ARRIVAL_TIME);
registerError(currStopTime, NewGTFSErrorType.REPEATED_ARRIVAL_TIME);
}
if (currStopTime.pickup_type == 1 && currStopTime.drop_off_type == 1 && currStopTime.timepoint == 0) {
// stop_time allows neither pickup nor drop off and is not a timepoint, so it serves no purpose.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ public void tripTravelingTooSlowWithMissingStopTimesHasError() {
}

@Test
public void tripHasDuplicateArrivalTimesHasError(){checkFeedHasError(INVALID_ARRIVAL_TIME,"7",2);}
public void tripHasDuplicateArrivalTimesHasError() {
checkFeedHasError(REPEATED_ARRIVAL_TIME,"7",2);
}

/**
* Check that the test feed has exactly one error for the given type, entityId, and entitySequence.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign,pickup_t
6,00:00:00,00:00:00,4957,1,,0,0,,1
6,,,1558,2,,0,0,8.34879971,0
6,23:59:00,23:59:00,1562,3,,0,0,9.39290047,0
7,18000,18000,4957,1,,0,0,,0
7,18000,18000,1558,2,,0,0,8.34879971,0
7,01:00:00,01:00:00,4957,1,,0,0,,0
7,01:00:00,01:00:00,1558,2,,0,0,8.34879971,0

0 comments on commit 9fbdaa9

Please sign in to comment.