MobilityData / gtfs-validator

Canonical GTFS Validator project for schedule (static) files.
https://gtfs-validator.mobilitydata.org/
Apache License 2.0
290 stars 101 forks source link

fix: make stop_without_zone_id conditional on fare rule type #1681

Closed krnlmstrd closed 9 months ago

krnlmstrd commented 9 months ago

Summary:

Resolves #1663 by updating StopZoneIdValidator to issue notice about a stop without zone_id defined only when the stop is contained in a trip contained in a route defined in a fare rule with zone fields defined. Change from previous logic which warned about stops without zone_id defined if any fare rules had zone fields defined.

Expected behavior:

If a stop of location_type 0 does not have a zone_id defined, and that stop is defined as part of a trip in stop_times.txt, and that trip is defined as part of a route in trips.txt, and that route is defined in a fare rule in fare_rules.txt, and that fare rule has any of origin_id, destination_id, or contains_id defined, then a stop_without_zone_id notice is issued.

Exactly one notice is issued per stop that meets the criteria to issue a notice even if that stop meets the notice criteria through multiple combinations of trips, routes, and fare rules.

The notice is never issued if a stop has a zone_id defined, even if that zone_id is never defined in a zone field of a fare rule associated with the stop by the (stop_time > trip > route) chain described above.

This pull request fixes the issue on the test feed provided by westontrillium in google/transit #429.

Validator results on test feed without fix: Validator results without fix

Validator results on test feed with fix: Validator results with fix

Please make sure these boxes are checked before submitting your pull request - thanks!

welcome[bot] commented 9 months ago

Thanks for opening this pull request! You're awesome. We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of titles with semantic prefixes:

CLAassistant commented 9 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: krnlmstrd
:x: michaelkearney55
You have signed the CLA already but the status is still pending? Let us recheck it.

krnlmstrd commented 9 months ago

I closed this pull request and deleted the fork because of issues with the email written into my commits and CLAassistant, and I submitted a (nearly) identical pull request.