diff --git a/detekt-baseline.xml b/detekt-baseline.xml
new file mode 100644
index 0000000..c3704cf
--- /dev/null
+++ b/detekt-baseline.xml
@@ -0,0 +1,212 @@
+
+
+
+
+ ComplexCondition:GRouteType.kt:GRouteType.Companion$routeType == EX_BUS_SERVICE.id || routeType == EX_DEMAND_AND_RESPONSE_BUS_SERVICE.id || routeType == EX_SHARE_TAXI_SERVICE.id || routeType == EX_COMMUNAL_TAXI_SERVICE.id
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$(stopIdIntsAfterCommonCount2 == 0 && stopIdIntsAfterCommonCount1 == 0) // #1 & #2 have same last stop || (dataLossAuthorized && (stopIdIntsAfterCommonCount2 > 0 && stopIdIntsAfterCommonCount1 > 0))
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$(stopNameList1First == stopNameList2First || (prefix1First2First.length >= minFixLength1First2First && prefix1First2First.length > suffix1First2First.length) || (suffix1First2First.length >= minFixLength1First2First && suffix1First2First.length > prefix1First2First.length))
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$(stopNameList1First == stopNameList2First || (prefix1First2First.length >= minFixLength1First2First && prefix1First2First.length > suffix1First2First.length) || (suffix1First2First.length >= minFixLength1First2First && suffix1First2First.length > prefix1First2First.length)) && (stopNameList1Last == stopNameList2Last || (prefix1Last2Last.length >= minFixLength1Last2Last && prefix1Last2Last.length > suffix1First2Last.length) || (suffix1Last2Last.length >= minFixLength1Last2Last && suffix1Last2Last.length > prefix1First2Last.length))
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$(stopNameList1Last == stopNameList2Last || (prefix1Last2Last.length >= minFixLength1Last2Last && prefix1Last2Last.length > suffix1First2Last.length) || (suffix1Last2Last.length >= minFixLength1Last2Last && suffix1Last2Last.length > prefix1First2Last.length))
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$directionHeadSigns.size == 2 // AM/PM only if 2 directions && (!agencyTools.directionHeadSignsDescriptive(directionHeadSigns) || directionHeadSigns.filterValues { it == "AM" || it == "PM" }.isNotEmpty())
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$distance1First2Last < distance2First1Last && (distance1First2Last < MAX_DISTANCE_TO_BE_SAME_TRANSIT_HUB_IN_METERS || (dataLossAuthorized && distance1First2Last < MAX_DISTANCE_TO_BE_SAME_TRANSIT_HUB_IN_METERS * 2f))
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$distance2First1Last < distance1First2Last && (distance2First1Last < MAX_DISTANCE_TO_BE_SAME_TRANSIT_HUB_IN_METERS || (dataLossAuthorized && distance2First1Last < MAX_DISTANCE_TO_BE_SAME_TRANSIT_HUB_IN_METERS * 2f))
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$firstCommonStopIdInt != null // has a common stop && (forceMerge // force merge || (stopIdIntsBeforeCommon.isEmpty() // has stops before common && stopIdIntsBeforeCommonPrepend.isNotEmpty()))
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$stopNameList1First == stopNameList2Last || (prefix1First2Last.length >= minFixLength1First2Last && prefix1First2Last.length > suffix1First2Last.length) || (suffix1First2Last.length >= minFixLength1First2Last && suffix1First2Last.length > prefix1First2Last.length)
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$stopNameList1Last == stopNameList2First || (prefix2First1Last.length >= minFixLength2First1Last && prefix2First1Last.length > suffix2First1Last.length) || (suffix2First1Last.length >= minFixLength2First1Last && suffix2First1Last.length > prefix2First1Last.length)
+ ComplexCondition:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$stopTimesList1FirstStop != null && stopTimesList1LastStop != null && stopTimesList2FirstStop != null && stopTimesList2LastStop != null
+ CyclomaticComplexMethod:CollectionsExt.kt:fun <T> Iterable<T>.overlap: Boolean
+ CyclomaticComplexMethod:DBUtils.kt:DBUtils$@Suppress("AssignedValueIsNeverRead") @JvmStatic fun selectSchedules: List<MSchedule>
+ CyclomaticComplexMethod:GCalendar.kt:GCalendar.Companion$private fun initAllDates
+ CyclomaticComplexMethod:GRoute.kt:GRoute.Companion$@JvmOverloads @JvmStatic fun fromLine
+ CyclomaticComplexMethod:MDataChangedManager.kt:MDataChangedManager$@Suppress("DiscouragedApi") @JvmStatic fun avoidCalendarDatesDataChanged
+ CyclomaticComplexMethod:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$@Suppress("DestructuringDeclarationWithTooManyEntries") @JvmStatic fun findDirectionHeadSigns: Map<Int, String>
+ CyclomaticComplexMethod:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$@VisibleForTesting internal fun findDirectionHeadSign: DirectionResult?
+ CyclomaticComplexMethod:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$private fun mergeTrips: MergedTrip?
+ CyclomaticComplexMethod:MDirectionSplitter.kt:MDirectionSplitter$@JvmStatic fun splitDirection
+ CyclomaticComplexMethod:MDirectionSplitter.kt:MDirectionSplitter$fun splitDirections: MutableList<DirectionTripsStops>
+ CyclomaticComplexMethod:MRouteSNToIDConverter.kt:MRouteSNToIDConverter$@JvmOverloads @JvmStatic fun convert: Long
+ CyclomaticComplexMethod:MRouteSNToIDConverter.kt:MRouteSNToIDConverter$@JvmStatic fun endsWithLetter
+ CyclomaticComplexMethod:MRouteSNToIDConverter.kt:MRouteSNToIDConverter$@JvmStatic fun startsWithLetter
+ CyclomaticComplexMethod:MSchedule.kt:MSchedule$fun toFile
+ CyclomaticComplexMethod:MStopIDConverter.kt:MStopIDConverter$@JvmStatic fun endsWithLetter
+ CyclomaticComplexMethod:MStopIDConverter.kt:MStopIDConverter$@JvmStatic fun startsWithLetter
+ CyclomaticComplexMethod:MStopIDConverter.kt:MStopIDConverter$@Throws(RuntimeException::class) @JvmOverloads @JvmStatic fun convert: Int
+ LargeClass:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder
+ LargeClass:MDirectionHeadSignFinderTest.kt:MDirectionHeadSignFinderTest
+ LongMethod:CollectionsExt.kt:fun <T> Iterable<T>.overlap: Boolean
+ LongMethod:DBUtils.kt:DBUtils$@Suppress("AssignedValueIsNeverRead") @JvmStatic fun selectSchedules: List<MSchedule>
+ LongMethod:LocationUtils.kt:LocationUtils$private fun computeDistanceAndBearing
+ LongMethod:MDataChangedManager.kt:MDataChangedManager$@Suppress("DiscouragedApi") @JvmStatic fun avoidCalendarDatesDataChanged
+ LongMethod:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$@Suppress("DestructuringDeclarationWithTooManyEntries") @JvmStatic fun findDirectionHeadSigns: Map<Int, String>
+ LongMethod:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$@VisibleForTesting internal fun findDirectionHeadSign: DirectionResult?
+ LongMethod:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$private fun mergeTrips: MergedTrip?
+ LongMethod:MDirectionHeadSignFinderTest.kt:MDirectionHeadSignFinderTest$@Test fun testFindDirectionHeadSign_DistinctLastStopNoClearWinnerMerge
+ LongMethod:MDirectionSplitter.kt:MDirectionSplitter$@JvmStatic fun splitDirection
+ LongMethod:MDirectionSplitter.kt:MDirectionSplitter$fun splitDirections: MutableList<DirectionTripsStops>
+ LoopWithTooManyJumpStatements:CollectionsExt.kt:while
+ LoopWithTooManyJumpStatements:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$for
+ LoopWithTooManyJumpStatements:MDirectionSplitter.kt:MDirectionSplitter$for
+ MagicNumber:DateUtils.kt:DateUtils$23
+ MagicNumber:DateUtils.kt:DateUtils$59
+ MagicNumber:DateUtils.kt:DateUtils$999
+ MagicNumber:GDirectionId.kt:GDirectionId.NEW_1$19
+ MagicNumber:GDirectionId.kt:GDirectionId.NEW_2$29
+ MagicNumber:GDirectionId.kt:GDirectionId.NONE$9
+ MagicNumber:GDropOffType.kt:GDropOffType.MUST_COORDINATE_WITH_DRIVER$3
+ MagicNumber:GFieldTypes.kt:GFieldTypes$6
+ MagicNumber:GLocationType.kt:GLocationType.BOARDING_AREA$4
+ MagicNumber:GLocationType.kt:GLocationType.GENERIC_NODE$3
+ MagicNumber:GPickupType.kt:GPickupType.MUST_COORDINATE_WITH_DRIVER$3
+ MagicNumber:GRouteType.kt:GRouteType.BUS$3
+ MagicNumber:GRouteType.kt:GRouteType.EX_BUS_SERVICE$700
+ MagicNumber:GRouteType.kt:GRouteType.EX_COMMUNAL_TAXI_SERVICE$1501
+ MagicNumber:GRouteType.kt:GRouteType.EX_DEMAND_AND_RESPONSE_BUS_SERVICE$715
+ MagicNumber:GRouteType.kt:GRouteType.EX_SHARE_TAXI_SERVICE$717
+ MagicNumber:GRouteType.kt:GRouteType.EX_TRAM_SERVICE$900
+ MagicNumber:GRouteType.kt:GRouteType.EX_URBAN_RAILWAY_SERVICE$400
+ MagicNumber:GRouteType.kt:GRouteType.FERRY$4
+ MagicNumber:GTime.kt:GTime$12_00_00
+ MagicNumber:GTime.kt:GTime$12_99_99
+ MagicNumber:GTime.kt:GTime$24_00_00
+ MagicNumber:GTime.kt:GTime$6
+ MagicNumber:LocationUtils.kt:LocationUtils$1.0e-12
+ MagicNumber:LocationUtils.kt:LocationUtils$16384.0
+ MagicNumber:LocationUtils.kt:LocationUtils$175.0
+ MagicNumber:LocationUtils.kt:LocationUtils$180.0
+ MagicNumber:LocationUtils.kt:LocationUtils$3.0
+ MagicNumber:LocationUtils.kt:LocationUtils$320.0
+ MagicNumber:LocationUtils.kt:LocationUtils$4.0
+ MagicNumber:LocationUtils.kt:LocationUtils$4096.0
+ MagicNumber:LocationUtils.kt:LocationUtils$6.0
+ MagicNumber:LocationUtils.kt:LocationUtils$768
+ MagicNumber:MDataChangedManager.kt:MDataChangedManager$7
+ MagicNumber:MDirectionCardinalType.kt:MDirectionCardinalType$3
+ MagicNumber:MDirectionCardinalType.kt:MDirectionCardinalType$4
+ MagicNumber:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$0.5f
+ MagicNumber:MDirectionSplitter.kt:MDirectionSplitter$.33f
+ MagicNumber:MDirectionSplitter.kt:MDirectionSplitter$0.50f
+ MagicNumber:MDirectionSplitter.kt:MDirectionSplitter$100f
+ MagicNumber:MDropOffType.kt:MDropOffType.MUST_COORDINATE_WITH_DRIVER$3
+ MagicNumber:MPickupType.kt:MPickupType.MUST_COORDINATE_WITH_DRIVER$3
+ MagicNumber:MRouteSNToIDConverter.kt:MRouteSNToIDConverter$3
+ MagicNumber:MSchedule.kt:MSchedule$100
+ MagicNumber:MServiceDate.kt:MServiceDate.Companion$3
+ NewLineAtEndOfFile:CharUtils.kt:org.mtransit.parser.CharUtils.kt
+ NewLineAtEndOfFile:CloseableUtils.kt:org.mtransit.commons.CloseableUtils.kt
+ NewLineAtEndOfFile:CollectionsExt.kt:org.mtransit.commons.CollectionsExt.kt
+ NewLineAtEndOfFile:CollectionsExtTest.kt:org.mtransit.commons.CollectionsExtTest.kt
+ NewLineAtEndOfFile:DBUtils.kt:org.mtransit.parser.db.DBUtils.kt
+ NewLineAtEndOfFile:DirectionResult.kt:org.mtransit.parser.mt.DirectionResult.kt
+ NewLineAtEndOfFile:DirectionTripsStops.kt:org.mtransit.parser.mt.DirectionTripsStops.kt
+ NewLineAtEndOfFile:DumpDbUtils.kt:org.mtransit.parser.db.DumpDbUtils.kt
+ NewLineAtEndOfFile:GAgency.kt:org.mtransit.parser.gtfs.data.GAgency.kt
+ NewLineAtEndOfFile:GCalendar.kt:org.mtransit.parser.gtfs.data.GCalendar.kt
+ NewLineAtEndOfFile:GCalendarDate.kt:org.mtransit.parser.gtfs.data.GCalendarDate.kt
+ NewLineAtEndOfFile:GCalendarDatesExceptionType.kt:org.mtransit.parser.gtfs.data.GCalendarDatesExceptionType.kt
+ NewLineAtEndOfFile:GDirection.kt:org.mtransit.parser.gtfs.data.GDirection.kt
+ NewLineAtEndOfFile:GDirectionId.kt:org.mtransit.parser.gtfs.data.GDirectionId.kt
+ NewLineAtEndOfFile:GDirectionType.kt:org.mtransit.parser.gtfs.data.GDirectionType.kt
+ NewLineAtEndOfFile:GDropOffType.kt:org.mtransit.parser.gtfs.data.GDropOffType.kt
+ NewLineAtEndOfFile:GFieldTypes.kt:org.mtransit.parser.gtfs.data.GFieldTypes.kt
+ NewLineAtEndOfFile:GFrequency.kt:org.mtransit.parser.gtfs.data.GFrequency.kt
+ NewLineAtEndOfFile:GIDs.kt:org.mtransit.parser.gtfs.data.GIDs.kt
+ NewLineAtEndOfFile:GPickupType.kt:org.mtransit.parser.gtfs.data.GPickupType.kt
+ NewLineAtEndOfFile:GRouteType.kt:org.mtransit.parser.gtfs.data.GRouteType.kt
+ NewLineAtEndOfFile:GStop.kt:org.mtransit.parser.gtfs.data.GStop.kt
+ NewLineAtEndOfFile:GStopTime.kt:org.mtransit.parser.gtfs.data.GStopTime.kt
+ NewLineAtEndOfFile:GTFSDataBase.kt:org.mtransit.parser.db.GTFSDataBase.kt
+ NewLineAtEndOfFile:GTime.kt:org.mtransit.parser.gtfs.data.GTime.kt
+ NewLineAtEndOfFile:GTimePoint.kt:org.mtransit.parser.gtfs.data.GTimePoint.kt
+ NewLineAtEndOfFile:GTrip.kt:org.mtransit.parser.gtfs.data.GTrip.kt
+ NewLineAtEndOfFile:GTripStop.kt:org.mtransit.parser.gtfs.data.GTripStop.kt
+ NewLineAtEndOfFile:GWheelchairBoardingType.kt:org.mtransit.parser.gtfs.data.GWheelchairBoardingType.kt
+ NewLineAtEndOfFile:HtmlSymbols.kt:org.mtransit.commons.HtmlSymbols.kt
+ NewLineAtEndOfFile:IntExt.kt:org.mtransit.commons.IntExt.kt
+ NewLineAtEndOfFile:Letters.kt:org.mtransit.commons.Letters.kt
+ NewLineAtEndOfFile:LocationUtils.kt:org.mtransit.parser.LocationUtils.kt
+ NewLineAtEndOfFile:MAgency.kt:org.mtransit.parser.mt.data.MAgency.kt
+ NewLineAtEndOfFile:MAgencyTests.kt:org.mtransit.parser.mt.data.MAgencyTests.kt
+ NewLineAtEndOfFile:MDataChangedManager.kt:org.mtransit.parser.mt.MDataChangedManager.kt
+ NewLineAtEndOfFile:MDirection.kt:org.mtransit.parser.mt.data.MDirection.kt
+ NewLineAtEndOfFile:MDirectionCardinalType.kt:org.mtransit.parser.mt.data.MDirectionCardinalType.kt
+ NewLineAtEndOfFile:MDirectionHeadSignFinder.kt:org.mtransit.parser.mt.MDirectionHeadSignFinder.kt
+ NewLineAtEndOfFile:MDirectionHeadSignFinderTest.kt:org.mtransit.parser.mt.MDirectionHeadSignFinderTest.kt
+ NewLineAtEndOfFile:MDirectionInboundType.kt:org.mtransit.parser.mt.data.MDirectionInboundType.kt
+ NewLineAtEndOfFile:MDirectionSplitter.kt:org.mtransit.parser.mt.MDirectionSplitter.kt
+ NewLineAtEndOfFile:MDirectionSplitterTest.kt:org.mtransit.parser.mt.MDirectionSplitterTest.kt
+ NewLineAtEndOfFile:MDirectionStop.kt:org.mtransit.parser.mt.data.MDirectionStop.kt
+ NewLineAtEndOfFile:MDirectionType.kt:org.mtransit.parser.mt.data.MDirectionType.kt
+ NewLineAtEndOfFile:MDropOffType.kt:org.mtransit.parser.mt.data.MDropOffType.kt
+ NewLineAtEndOfFile:MFrequency.kt:org.mtransit.parser.mt.data.MFrequency.kt
+ NewLineAtEndOfFile:MGeneratorTest.kt:org.mtransit.parser.mt.MGeneratorTest.kt
+ NewLineAtEndOfFile:MPickupType.kt:org.mtransit.parser.mt.data.MPickupType.kt
+ NewLineAtEndOfFile:MReader.kt:org.mtransit.parser.mt.MReader.kt
+ NewLineAtEndOfFile:MRouteSNToIDConverterTest.kt:org.mtransit.parser.mt.data.MRouteSNToIDConverterTest.kt
+ NewLineAtEndOfFile:MServiceDate.kt:org.mtransit.parser.mt.data.MServiceDate.kt
+ NewLineAtEndOfFile:MServiceDateTest.kt:org.mtransit.parser.mt.data.MServiceDateTest.kt
+ NewLineAtEndOfFile:MSpec.kt:org.mtransit.parser.mt.data.MSpec.kt
+ NewLineAtEndOfFile:MStop.kt:org.mtransit.parser.mt.data.MStop.kt
+ NewLineAtEndOfFile:MStrings.kt:org.mtransit.parser.mt.data.MStrings.kt
+ NewLineAtEndOfFile:MergedTrip.kt:org.mtransit.parser.mt.MergedTrip.kt
+ NewLineAtEndOfFile:ParserMain.kt:org.mtransit.parser.scratch.ParserMain.kt
+ NewLineAtEndOfFile:SQLUtils.kt:org.mtransit.parser.db.SQLUtils.kt
+ NewLineAtEndOfFile:StringUtils.kt:org.mtransit.parser.StringUtils.kt
+ NewLineAtEndOfFile:TimeUtilsTest.kt:org.mtransit.parser.TimeUtilsTest.kt
+ NewLineAtEndOfFile:TorontoTTCCommons.kt:org.mtransit.commons.TorontoTTCCommons.kt
+ ReturnCount:AgencyConfig.kt:AgencyConfig$fun getAllLanguages: List<Locale>?
+ ReturnCount:CollectionsExt.kt:fun <T> Iterable<T>.intersectWithOrder: Set<T>
+ ReturnCount:CollectionsExt.kt:fun <T> Iterable<T>.overlap: Boolean
+ ReturnCount:GCalendar.kt:GCalendar$@Suppress("unused") fun isInside: Boolean
+ ReturnCount:GCalendar.kt:GCalendar$@Suppress("unused") fun isOverlapping: Boolean
+ ReturnCount:GCalendarDate.kt:GCalendarDate.Companion$@JvmStatic fun isServiceEntirelyRemoved: Boolean
+ ReturnCount:GDropOffType.kt:GDropOffType.Companion$fun parse: GDropOffType
+ ReturnCount:GFieldTypes.kt:GFieldTypes$fun Int.isBetween: Boolean
+ ReturnCount:GPickupType.kt:GPickupType.Companion$fun parse: GPickupType
+ ReturnCount:GRoute.kt:GRoute.Companion$@JvmStatic fun mergeRouteColors: String?
+ ReturnCount:GRoute.kt:GRoute.Companion$@JvmStatic fun mergeRouteLongNames: String?
+ ReturnCount:GRoute.kt:GRoute.Companion$@JvmStatic fun mergeRouteSortOrders: Int?
+ ReturnCount:GRouteType.kt:GRouteType.Companion$@JvmStatic fun isSameType: Boolean
+ ReturnCount:GSpecExt.kt:fun GSpec.isInsideGCalendars: Boolean?
+ ReturnCount:GStopTime.kt:GStopTime$fun isRegular: Boolean
+ ReturnCount:GStopTime.kt:GStopTime$override fun compareTo: Int
+ ReturnCount:MAgency.kt:MAgency.Companion$@JvmStatic fun pickColorFromRoutes: String?
+ ReturnCount:MDataChangedManager.kt:MDataChangedManager$@Suppress("DiscouragedApi") @JvmStatic fun avoidCalendarDatesDataChanged
+ ReturnCount:MDataChangedManager.kt:MDataChangedManager$@Suppress("unused") // TODO remove @JvmStatic fun addMissingDateToAvoidDataChanged
+ ReturnCount:MDataChangedManager.kt:MDataChangedManager$@Suppress("unused") // TODO remove @JvmStatic fun ignoreCalendarDateToAvoidDataChanged: Boolean
+ ReturnCount:MDirection.kt:MDirection.Companion$@JvmStatic fun mergeHeadsignValue: String?
+ ReturnCount:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$@VisibleForTesting internal fun findDirectionHeadSign: DirectionResult?
+ ReturnCount:MDirectionHeadSignFinder.kt:MDirectionHeadSignFinder$private fun mergeTrips: MergedTrip?
+ ReturnCount:MDirectionStop.kt:MDirectionStop$fun equalsDirectionAndStop: Boolean
+ ReturnCount:MReader.kt:MReader$@Suppress("unused") // TODO removed @JvmStatic fun readFirstLastDepartures: Pair<Int?, Int?>?
+ ReturnCount:MRouteSNToIDConverter.kt:MRouteSNToIDConverter$@JvmOverloads @JvmStatic fun convert: Long
+ ReturnCount:MSchedule.kt:MSchedule$@Suppress("unused") fun hasHeadsign: Boolean
+ ReturnCount:MSchedule.kt:MSchedule$fun isSameServiceRDSDeparture: Boolean
+ ReturnCount:MStopIDConverter.kt:MStopIDConverter$@Throws(RuntimeException::class) @JvmOverloads @JvmStatic fun convert: Int
+ ReturnCount:MStrings.kt:MStrings$@JvmStatic fun convert: String
+ ReturnCount:RouteConfig.kt:RouteConfig$fun cleanStopHeadsign: String
+ ReturnCount:RouteConfig.kt:RouteConfig$fun excludeStopTime: Boolean
+ ReturnCount:RouteConfig.kt:RouteConfig$fun excludeTrip: Boolean
+ ThrowsCount:DBUtils.kt:DBUtils$@Suppress("unused") @Deprecated("Use GTFSDataBase instead.") @JvmStatic fun insertStopTime
+ ThrowsCount:GCalendar.kt:GCalendar.Companion$@JvmStatic fun fromLine: GCalendar
+ ThrowsCount:MRouteSNToIDConverter.kt:MRouteSNToIDConverter$@JvmOverloads @JvmStatic fun convert: Long
+ ThrowsCount:MStopIDConverter.kt:MStopIDConverter$@Throws(RuntimeException::class) @JvmOverloads @JvmStatic fun convert: Int
+ TooGenericExceptionCaught:Configs.kt:Configs$e: Exception
+ TooGenericExceptionCaught:DBUtils.kt:DBUtils$e: Exception
+ TooGenericExceptionCaught:GCalendar.kt:GCalendar.Companion$e: Exception
+ TooGenericExceptionCaught:GTrip.kt:GTrip.Companion$e: Exception
+ TooGenericExceptionCaught:MReader.kt:MReader$e: Exception
+ TooGenericExceptionCaught:MStoreListingGenerator.kt:MStoreListingGenerator$ioe: Exception
+ TooGenericExceptionThrown:MStopIDConverter.kt:MStopIDConverter$throw RuntimeException("Unexpected digits '$digits' in stop ID '$stopIdS' to convert to integer!")
+ TooGenericExceptionThrown:MStopIDConverter.kt:MStopIDConverter$throw RuntimeException("Unexpected next characters '$nextChars' in stop ID '$stopIdS'!")
+ TooGenericExceptionThrown:MStopIDConverter.kt:MStopIDConverter$throw RuntimeException("Unexpected previous characters '$previousChars' in stop ID '$stopIdS'!")
+ TooGenericExceptionThrown:MStopIDConverter.kt:MStopIDConverter$throw RuntimeException("Unexpected stop ID '$stopIdS' can not be parsed by regex!")
+ TooGenericExceptionThrown:MStopIDConverter.kt:MStopIDConverter$throw RuntimeException("Unexpected stop ID '$stopIdS' to convert to integer!")
+ TooManyFunctions:DBUtils.kt:DBUtils
+ TooManyFunctions:GCalendar.kt:GCalendar
+ TooManyFunctions:GFieldTypes.kt:GFieldTypes
+ TooManyFunctions:GTFSDataBase.kt:GTFSDataBase
+ TooManyFunctions:GTime.kt:GTime
+ TooManyFunctions:RouteConfig.kt:RouteConfig
+ TooManyFunctions:SQLUtils.kt:SQLUtils
+
+
diff --git a/src/main/java/org/mtransit/commons/CloseableUtils.kt b/src/main/java/org/mtransit/commons/CloseableUtils.kt
index 1ecc57b..7d986e7 100644
--- a/src/main/java/org/mtransit/commons/CloseableUtils.kt
+++ b/src/main/java/org/mtransit/commons/CloseableUtils.kt
@@ -15,7 +15,7 @@ object CloseableUtils {
fun closeQuietly(closeable: Closeable?) {
try {
closeable?.close()
- } catch (ioe: IOException) {
+ } catch (_: IOException) {
// ignore
}
}
diff --git a/src/main/java/org/mtransit/parser/gtfs/data/GCalendarDate.kt b/src/main/java/org/mtransit/parser/gtfs/data/GCalendarDate.kt
index e36f7b4..727f28d 100644
--- a/src/main/java/org/mtransit/parser/gtfs/data/GCalendarDate.kt
+++ b/src/main/java/org/mtransit/parser/gtfs/data/GCalendarDate.kt
@@ -143,7 +143,7 @@ data class GCalendarDate(
val startDateToCheck = max(startDate, gCalendar.startDate)
val endDateToCheck = min(endDate, gCalendar.endDate)
val gCalendarDateServiceId = gCalendarDates?.filter { it.isServiceIdInt(gCalendar.serviceIdInt) } ?: return false // NOT entirely removed
- (startDateToCheck..endDateToCheck).forEach { date ->
+ for (date in startDateToCheck..endDateToCheck) {
if (gCalendarDateServiceId.none { it.isDate(date) && it.exceptionType == GCalendarDatesExceptionType.SERVICE_REMOVED }) {
return false // NOT entirely removed
}
diff --git a/src/main/java/org/mtransit/parser/gtfs/data/GFrequency.kt b/src/main/java/org/mtransit/parser/gtfs/data/GFrequency.kt
index 86a4f60..abfb731 100644
--- a/src/main/java/org/mtransit/parser/gtfs/data/GFrequency.kt
+++ b/src/main/java/org/mtransit/parser/gtfs/data/GFrequency.kt
@@ -10,8 +10,8 @@ import java.util.concurrent.TimeUnit
// https://gtfs.org/reference/static/#frequenciestxt
data class GFrequency(
val tripIdInt: Int,
- private val _startTime: Int,
- private val _endTime: Int,
+ val startTime: Int,
+ val endTime: Int,
val headwaySecs: Int,
val exactTimes: Int?,
) {
@@ -38,23 +38,19 @@ data class GFrequency(
private val _tripId: String
get() = GIDs.getString(tripIdInt)
- val startTime: Int = _startTime
-
@Suppress("unused")
val startTimeDate: Date
- get() = GTime.toDate(_startTime)
+ get() = GTime.toDate(startTime)
val startTimeMs: Long
- get() = GTime.toMs(_startTime)
-
- val endTime: Int = _endTime
+ get() = GTime.toMs(startTime)
@Suppress("unused")
val endTimeDate: Date
- get() = GTime.toDate(_endTime)
+ get() = GTime.toDate(endTime)
val endTimeMs: Long
- get() = GTime.toMs(_endTime)
+ get() = GTime.toMs(endTime)
val headwayMs: Long
get() = TimeUnit.SECONDS.toMillis(headwaySecs.toLong())
@@ -67,8 +63,8 @@ data class GFrequency(
fun to() = Frequency(
tripId = _tripId,
- startTime = GTime.toString(_startTime),
- endTime = GTime.toString(_endTime),
+ startTime = GTime.toString(startTime),
+ endTime = GTime.toString(endTime),
headwaySecs = headwaySecs,
exactTimes = exactTimes
)
diff --git a/src/main/java/org/mtransit/parser/gtfs/data/GLocationType.kt b/src/main/java/org/mtransit/parser/gtfs/data/GLocationType.kt
index debaccc..01bcaac 100644
--- a/src/main/java/org/mtransit/parser/gtfs/data/GLocationType.kt
+++ b/src/main/java/org/mtransit/parser/gtfs/data/GLocationType.kt
@@ -3,11 +3,37 @@ package org.mtransit.parser.gtfs.data
// https://gtfs.org/schedule/reference/#stopstxt
enum class GLocationType(val id: Int) {
- STOP_PLATFORM(0), // Stop (or Platform). A location where passengers board or disembark from a transit vehicle. Is called a platform when defined within a parent_station.
- STATION(1), // Station. A physical structure or area that contains one or more platform.
- ENTRANCE_EXIT(2), // Entrance/Exit. A location where passengers can enter or exit a station from the street. If an entrance/exit belongs to multiple stations, it may be linked by pathways to both, but the data provider must pick one of them as parent.
- GENERIC_NODE(3), // Generic Node. A location within a station, not matching any other location_type, that may be used to link together pathways define in pathways.txt.
- BOARDING_AREA(4) // Boarding Area. A specific location on a platform, where passengers can board and/or alight vehicles.
+ /**
+ * Stop (or Platform).
+ * A location where passengers board or disembark from a transit vehicle.
+ * Is called a platform when defined within a parent_station.
+ */
+ STOP_PLATFORM(0),
+
+ /**
+ * Station.
+ * A physical structure or area that contains one or more platforms.
+ */
+ STATION(1),
+
+ /**
+ * Entrance/Exit.
+ * A location where passengers can enter or exit a station from the street.
+ * If an entrance/exit belongs to multiple stations, it may be linked by pathways to both, but the data provider must pick one of them as parent.
+ */
+ ENTRANCE_EXIT(2),
+
+ /**
+ * Generic Node.
+ * A location within a station, not matching any other location_type, that may be used to link together pathways define in pathways.txt.
+ */
+ GENERIC_NODE(3),
+
+ /**
+ * Boarding Area.
+ * A specific location on a platform, where passengers can board and/or alight vehicles.
+ */
+ BOARDING_AREA(4)
;
companion object {
diff --git a/src/main/java/org/mtransit/parser/gtfs/data/GStopTime.kt b/src/main/java/org/mtransit/parser/gtfs/data/GStopTime.kt
index e6341c1..e184a51 100644
--- a/src/main/java/org/mtransit/parser/gtfs/data/GStopTime.kt
+++ b/src/main/java/org/mtransit/parser/gtfs/data/GStopTime.kt
@@ -11,8 +11,8 @@ import java.util.Date
// https://gtfs.org/schedule/reference/#stop_timestxt
data class GStopTime(
val tripIdInt: Int,
- private val _arrivalTime: Int, // HHmmss
- private val _departureTime: Int, // HHmmss
+ val arrivalTime: Int, // HHmmss
+ val departureTime: Int, // HHmmss
val stopIdInt: Int,
val stopSequence: Int,
val stopHeadsign: String?,
@@ -33,8 +33,8 @@ data class GStopTime(
timePointInt: Int,
) : this(
tripIdInt = tripIdInt,
- _arrivalTime = arrivalTime,
- _departureTime = departureTime,
+ arrivalTime = arrivalTime,
+ departureTime = departureTime,
stopIdInt = stopIdInt,
stopSequence = stopSequence,
stopHeadsign = stopHeadsign,
@@ -55,8 +55,8 @@ data class GStopTime(
timePoint: GTimePoint,
) : this(
tripIdInt = GIDs.getInt(tripId),
- _arrivalTime = arrivalTime,
- _departureTime = departureTime,
+ arrivalTime = arrivalTime,
+ departureTime = departureTime,
stopIdInt = stopIdInt,
stopSequence = stopSequence,
stopHeadsign = stopHeadsign,
@@ -77,8 +77,8 @@ data class GStopTime(
timePoint: GTimePoint,
) : this(
tripIdInt = GIDs.getInt(tripId),
- _arrivalTime = GTime.fromString(arrivalTime),
- _departureTime = GTime.fromString(departureTime),
+ arrivalTime = GTime.fromString(arrivalTime),
+ departureTime = GTime.fromString(departureTime),
stopIdInt = GIDs.getInt(stopId),
stopSequence = stopSequence,
stopHeadsign = stopHeadsign,
@@ -101,28 +101,24 @@ data class GStopTime(
private val _stopId: String
get() = GIDs.getString(stopIdInt)
- val arrivalTime: Int = _arrivalTime
-
- fun hasArrivalTime() = _arrivalTime >= 0
+ fun hasArrivalTime() = arrivalTime >= 0
@Suppress("unused")
val arrivalTimeMs: Long
- get() = GTime.toMs(_arrivalTime)
+ get() = GTime.toMs(arrivalTime)
@Suppress("unused")
val arrivalTimeDate: Date
- get() = GTime.toDate(_arrivalTime)
-
- val departureTime: Int = _departureTime
+ get() = GTime.toDate(arrivalTime)
- fun hasDepartureTime() = _departureTime >= 0
+ fun hasDepartureTime() = departureTime >= 0
val departureTimeMs: Long
- get() = GTime.toMs(_departureTime)
+ get() = GTime.toMs(departureTime)
@Suppress("unused")
val departureTimeDate: Date
- get() = GTime.toDate(_departureTime)
+ get() = GTime.toDate(departureTime)
val uID by lazy { getNewUID(tripIdInt, stopIdInt, stopSequence) }
@@ -149,8 +145,8 @@ data class GStopTime(
if (this.stopSequence != other.stopSequence) {
return this.stopSequence.compareTo(other.stopSequence)
}
- if (this._departureTime != other._departureTime) {
- return this._departureTime.compareTo(other._departureTime)
+ if (this.departureTime != other.departureTime) {
+ return this.departureTime.compareTo(other.departureTime)
}
throw MTLog.Fatal("Unexpected stop times to compare: '$this' & '$other'!")
}
@@ -167,9 +163,9 @@ data class GStopTime(
add("s:$_stopId")
add("#:$stopSequence")
if (hasDepartureTime()) {
- add("d:${GTime.toString(_departureTime)}")
+ add("d:${GTime.toString(departureTime)}")
} else if (hasArrivalTime()) {
- add("a:${GTime.toString(_arrivalTime)}")
+ add("a:${GTime.toString(arrivalTime)}")
}
if (pickupType != GPickupType.REGULAR) {
add("$pickupType")
@@ -184,8 +180,8 @@ data class GStopTime(
tripId = _tripId,
stopId = _stopId,
stopSequence = stopSequence,
- arrivalTime = GTime.toString(_arrivalTime),
- departureTime = GTime.toString(_departureTime),
+ arrivalTime = GTime.toString(arrivalTime),
+ departureTime = GTime.toString(departureTime),
stopHeadsign = stopHeadsign,
pickupType = pickupType.id,
dropOffType = dropOffType.id,
diff --git a/src/main/java/org/mtransit/parser/mt/MDataChangedManager.kt b/src/main/java/org/mtransit/parser/mt/MDataChangedManager.kt
index 8babd1a..6df9a0f 100644
--- a/src/main/java/org/mtransit/parser/mt/MDataChangedManager.kt
+++ b/src/main/java/org/mtransit/parser/mt/MDataChangedManager.kt
@@ -40,7 +40,9 @@ object MDataChangedManager {
if (gCalendarDateToAdd.date in lastStartDate..lastEndDate) {
return false // same date range
}
- val diffInMs = DefaultAgencyTools.diffInMs(GFieldTypes.makeDateFormat(), Calendar.getInstance(), p.todayStringInt, gCalendarDateToAdd.date).absoluteValue
+ val diffInMs = DefaultAgencyTools.diffInMs(
+ GFieldTypes.makeDateFormat(), Calendar.getInstance(), p.todayStringInt, gCalendarDateToAdd.date
+ ).absoluteValue
if (diffInMs < MIN_NOT_IGNORED_IN_DAYS.days.inWholeMilliseconds) {
return false // too soon to ignore
}
@@ -203,7 +205,10 @@ object MDataChangedManager {
}
val updatedCalendar = originalCalendar.copy(startDate = removedServiceDate.calendarDate)
if (updatedCalendar.dates.size - originalCalendar.dates.size != 1) {
- MTLog.log("> Cannot re-add removed dates because of wrong number of added dates (${updatedCalendar.dates.size} vs ${originalCalendar.dates.size})")
+ MTLog.log(
+ "> Cannot re-add removed dates because of wrong number of added dates " +
+ "(${updatedCalendar.dates.size} vs ${originalCalendar.dates.size})"
+ )
return
}
newGCalendars.remove(originalCalendar)
@@ -263,7 +268,10 @@ object MDataChangedManager {
}
val updatedCalendar = originalCalendar.copy(startDate = dayAfterRemovedDate)
if (originalCalendar.dates.size - updatedCalendar.dates.size != 1) {
- MTLog.log("> Cannot remove added dates because of wrong number of added dates (${updatedCalendar.dates.size} vs ${originalCalendar.dates.size})")
+ MTLog.log(
+ "> Cannot remove added dates because of wrong number of added dates " +
+ "(${updatedCalendar.dates.size} vs ${originalCalendar.dates.size})"
+ )
return
}
newGCalendars.remove(originalCalendar)
@@ -304,7 +312,10 @@ object MDataChangedManager {
}
val updatedCalendar = originalCalendar.copy(endDate = dayBeforeRemovedDate)
if (originalCalendar.dates.size - updatedCalendar.dates.size != 1) {
- MTLog.log("> Cannot remove added dates because of wrong number of added dates (${updatedCalendar.dates.size} vs ${originalCalendar.dates.size})")
+ MTLog.log(
+ "> Cannot remove added dates because of wrong number of added dates " +
+ "(${updatedCalendar.dates.size} vs ${originalCalendar.dates.size})"
+ )
return
}
newGCalendars.remove(originalCalendar)
diff --git a/src/main/java/org/mtransit/parser/mt/MDirectionHeadSignFinder.kt b/src/main/java/org/mtransit/parser/mt/MDirectionHeadSignFinder.kt
index db1a144..b238d8d 100644
--- a/src/main/java/org/mtransit/parser/mt/MDirectionHeadSignFinder.kt
+++ b/src/main/java/org/mtransit/parser/mt/MDirectionHeadSignFinder.kt
@@ -32,6 +32,7 @@ object MDirectionHeadSignFinder {
private const val MIN_HEAD_SIGN_COUNT_PERCENT = .67f
+ @Suppress("DestructuringDeclarationWithTooManyEntries")
@JvmStatic
fun findDirectionHeadSigns(routeId: Long, gRouteTrips: List, routeGTFS: GSpec, agencyTools: GAgencyTools): Map {
val directionHeadSigns = mutableMapOf()
@@ -1034,11 +1035,11 @@ object MDirectionHeadSignFinder {
// cheating, just changing first arrival time / last departure time for AM/PM
val firstIdx = 0
if (mergedStopTimes[firstIdx].departureTime < otherStopTimesList.first().departureTime) {
- mergedStopTimes[firstIdx] = mergedStopTimes[firstIdx].copy(_departureTime = otherStopTimesList.first().departureTime)
+ mergedStopTimes[firstIdx] = mergedStopTimes[firstIdx].copy(departureTime = otherStopTimesList.first().departureTime)
}
val lastIdx = mergedStopTimes.size - 1
if (mergedStopTimes[lastIdx].arrivalTime > otherStopTimesList.last().arrivalTime) {
- mergedStopTimes[lastIdx] = mergedStopTimes[lastIdx].copy(_arrivalTime = otherStopTimesList.last().arrivalTime)
+ mergedStopTimes[lastIdx] = mergedStopTimes[lastIdx].copy(arrivalTime = otherStopTimesList.last().arrivalTime)
}
return mergedStopTimes
}
diff --git a/src/main/java/org/mtransit/parser/mt/MReader.kt b/src/main/java/org/mtransit/parser/mt/MReader.kt
index 39dd465..c4be8b6 100644
--- a/src/main/java/org/mtransit/parser/mt/MReader.kt
+++ b/src/main/java/org/mtransit/parser/mt/MReader.kt
@@ -47,14 +47,17 @@ object MReader {
// region first/last departures
- private fun makeFirstDepartureRegex(fileBase: String) =
- Regex(any(WHITESPACE_CAR) + "${group(oneOrMore(DIGIT_CAR))}" + any(ANY))
+ private fun makeFirstDepartureRegex(fileBase: String) = Regex(
+ any(WHITESPACE_CAR) + "${group(oneOrMore(DIGIT_CAR))}" + any(ANY)
+ )
- private fun makeLastDepartureRegex(fileBase: String) =
- Regex(any(WHITESPACE_CAR) + "${group(oneOrMore(DIGIT_CAR))}" + any(ANY))
+ private fun makeLastDepartureRegex(fileBase: String) = Regex(
+ any(WHITESPACE_CAR) + "${group(oneOrMore(DIGIT_CAR))}" + any(ANY)
+ )
- private fun makeTimeZoneRegex() =
- Regex(any(WHITESPACE_CAR) + "${group(oneOrMore(ALPHA_NUM_CAR) + "/" + oneOrMore(ALPHA_NUM_CAR))}")
+ private fun makeTimeZoneRegex() = Regex(
+ any(WHITESPACE_CAR) + "${group(oneOrMore(ALPHA_NUM_CAR) + "/" + oneOrMore(ALPHA_NUM_CAR))}"
+ )
@Suppress("unused") // TODO removed
@JvmStatic
diff --git a/src/main/java/org/mtransit/parser/mt/data/MSchedule.kt b/src/main/java/org/mtransit/parser/mt/data/MSchedule.kt
index ea22632..d1551e8 100644
--- a/src/main/java/org/mtransit/parser/mt/data/MSchedule.kt
+++ b/src/main/java/org/mtransit/parser/mt/data/MSchedule.kt
@@ -122,11 +122,11 @@ data class MSchedule( // MStopTime
}
if (FeatureFlags.F_EXPORT_TRIP_ID) {
if (FeatureFlags.F_EXPORT_ARRIVAL_W_TRIP_ID) {
- var arrivalDiff = (departure - arrival).takeIf { it > MIN_ARRIVAL_DIFF_IN_HH_MM_SS }
+ var departureArrivalDiff = (departure - arrival).takeIf { it > MIN_ARRIVAL_DIFF_IN_HH_MM_SS }
if (FeatureFlags.F_SCHEDULE_IN_MINUTES) {
- arrivalDiff = arrivalDiff?.div(100) // truncates the time to a minute that is closer to 0
+ departureArrivalDiff = departureArrivalDiff?.div(100) // truncates the time to a minute that is closer to 0
}
- add(arrivalDiff?.toString().orEmpty())
+ add(departureArrivalDiff?.toString().orEmpty())
}
add(_tripId.convertTripId(quotesString = true))
}
diff --git a/src/test/java/org/mtransit/parser/mt/MDirectionHeadSignFinderTest.kt b/src/test/java/org/mtransit/parser/mt/MDirectionHeadSignFinderTest.kt
index 32555a4..460a04e 100644
--- a/src/test/java/org/mtransit/parser/mt/MDirectionHeadSignFinderTest.kt
+++ b/src/test/java/org/mtransit/parser/mt/MDirectionHeadSignFinderTest.kt
@@ -453,8 +453,11 @@ class MDirectionHeadSignFinderTest {
assertEquals("foo foo/trip head-sign", result?.headSign)
}
+ /**
+ * should be same head-sign for same last stop, probably wrong data, use most popular / last stops
+ */
@Test
- fun testFindDirectionHeadSign_TripsWithMoreStopsMultipleHeadSignInclShorterTrips() { // should be same head-sign for same last stop, probably wrong data, use most popular / last stops
+ fun testFindDirectionHeadSign_TripsWithMoreStopsMultipleHeadSignInclShorterTrips() {
// Arrange
val directionId = GDirectionId.NONE.id
val tripId1 = "trip_id_1"