Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTC Field length validation #276

Merged
merged 19 commits into from
Apr 13, 2020
Merged

MTC Field length validation #276

merged 19 commits into from
Apr 13, 2020

Conversation

binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Apr 2, 2020

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • [na] The description lists all applicable issues this PR seeks to resolve
  • [na] The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

This PR adds the following (in pursuit of ibi-group/datatools-ui#544):

  • Ability to specify custom validator classes for method GTFS.validate() and related methods.
  • A custom validator MTCValidator for custom validation of 511 MTC guidelines on GTFS field length.
  • An entry in NewGTFSErrorType for field values that are too long.
  • Unit tests and a database loading/validation test case that uses MTCValidator.

landonreed and others added 5 commits April 1, 2020 13:57
@codecov-io
Copy link

codecov-io commented Apr 2, 2020

Codecov Report

Merging #276 into dev will increase coverage by 0.28%.
The diff coverage is 96.92%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #276      +/-   ##
============================================
+ Coverage     64.99%   65.28%   +0.28%     
- Complexity      866      879      +13     
============================================
  Files           134      135       +1     
  Lines          6725     6743      +18     
  Branches        789      794       +5     
============================================
+ Hits           4371     4402      +31     
+ Misses         2055     2040      -15     
- Partials        299      301       +2     
Impacted Files Coverage Δ Complexity Δ
...conveyal/gtfs/validator/ReversedTripValidator.java 8.77% <ø> (+0.43%) 3.00 <0.00> (ø)
src/main/java/com/conveyal/gtfs/loader/Feed.java 74.13% <66.66%> (-1.73%) 7.00 <0.00> (+1.00) ⬇️
...java/com/conveyal/gtfs/validator/MTCValidator.java 95.00% <95.00%> (ø) 10.00 <10.00> (?)
src/main/java/com/conveyal/gtfs/GTFS.java 55.55% <100.00%> (ø) 12.00 <0.00> (ø)
...java/com/conveyal/gtfs/error/NewGTFSErrorType.java 100.00% <100.00%> (ø) 2.00 <0.00> (ø)
src/main/java/com/conveyal/gtfs/model/Agency.java 71.42% <0.00%> (+2.04%) 2.00% <0.00%> (+1.00%)
...java/com/conveyal/gtfs/loader/EntityPopulator.java 91.22% <0.00%> (+6.43%) 27.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b4d6e6...12ff728. Read the comment docs.

@evansiroky
Copy link
Contributor

Unassigning myself until #277 gets merged.

@evansiroky evansiroky removed their assignment Apr 3, 2020
@@ -65,44 +58,51 @@ public Feed (DataSource dataSource, String tablePrefix) {
routes = new JDBCTableReader(Table.ROUTES, dataSource, tablePrefix, EntityPopulator.ROUTE);
stops = new JDBCTableReader(Table.STOPS, dataSource, tablePrefix, EntityPopulator.STOP);
trips = new JDBCTableReader(Table.TRIPS, dataSource, tablePrefix, EntityPopulator.TRIP);
// shapePoints = new JDBCTableReader(Table.SHAPES, dataSource, tablePrefix, EntityPopulator.SHAPE_POINT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this has been commented out for a while since @landonreed committed 9244ff0. But why? Should we add it back?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should. It might be worth revisiting #130.

Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to have a method renamed as indicated. Also curious what's up with the shape stuff being commented out or deleted.

@binh-dam-ibigroup
Copy link
Collaborator Author

PR requests addressed, and the tests are passing now... Please review.

@@ -11,6 +11,7 @@
URL_FORMAT(Priority.MEDIUM, "URL format should be <scheme>://<authority><path>?<query>#<fragment>"),
LANGUAGE_FORMAT(Priority.LOW, "Language should be specified with a valid BCP47 tag."),
ILLEGAL_FIELD_VALUE(Priority.MEDIUM, "Fields may not contain tabs, carriage returns or new lines."),
// The error type below is an MTC-specific requirement.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's organize these into sections instead of having an individual comment for potentially each error type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you have anything in mind for reorganizing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say one section for errors that apply during all types of validation and another section for MTC-specific errors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment about a comment. Good to go otherwise.

@evansiroky evansiroky removed their assignment Apr 6, 2020
Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the alphabetization!

@evansiroky evansiroky removed their assignment Apr 7, 2020
Copy link
Contributor

@landonreed landonreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! FYI I'm going to update the PR description to ref the issue in the Data Tools repo.

@landonreed landonreed merged commit 8e1de67 into dev Apr 13, 2020
@landonreed landonreed deleted the field-length-validator branch April 13, 2020 14:35
@landonreed landonreed mentioned this pull request Apr 13, 2020
7 tasks
@landonreed
Copy link
Contributor

🎉 This PR is included in version 6.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants