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

feat: Add unit-test to check consistency of Notice field names. #1345

Merged
merged 9 commits into from
Mar 22, 2023

Conversation

bdferris-v2
Copy link
Collaborator

While working on better alignment of code and documentation as part of #1324, I fixed a few inconsistent field names (e.g. filename vs fileName). But I also wonder if we could catch these inconsistencies earlier. This PR provides a unit-test that checks all Notice field names against a manually curated allow-list.

Any time a new field name is added, this unit-test will fail. When that happens, we hope the author will do one of the following:

  1. See there is an existing field name that might be more appropriate to use.
  2. If not, add their new field to the allow-list.

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

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues

@bdferris-v2
Copy link
Collaborator Author

@isabelle-dr curious to get your thoughts on this

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2023

✅ Rule acceptance tests passed.
New Errors: 0 out of 1419 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1419 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1419 sources (~0 %) are corrupted.
Commit: 1b563ee
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@isabelle-dr
Copy link
Contributor

Great addition! Can we see what it looks like when the test fails?

@bdferris-v2
Copy link
Collaborator Author

Ideally, a developer would run gradlew test before submitting their PR (per the instructions) and get a failing unit test that would look like:

Screenshot 2023-03-06 at 4 03 22 PM

In this example, csvRowNumberA and csvRowNumberB are the new unexpected fields (artificial example). At that point, the developer would hopefully go look at NoticeFieldsTest. testNoticeClassFieldNames, see the instructions there, and either change their field names or update the test.

@isabelle-dr isabelle-dr added this to the 4.1.0 milestone Mar 20, 2023
Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1423 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1423 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1423 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1423 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1423 sources (~0 %) are corrupted.
Commit: 592b853
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@bdferris-v2 bdferris-v2 merged commit 83efb84 into master Mar 22, 2023
@bdferris-v2 bdferris-v2 deleted the issue/1324/rules_documentation_test branch March 22, 2023 19:33
ryon pushed a commit to JarvusInnovations/gtfs-validator that referenced this pull request Apr 1, 2023
…lityData#1345)

* Add a unit-test that enforces consistency of Notice field names by checking against an allow-list of existing field names.

Co-authored-by: David Gamez <1192523+davidgamez@users.noreply.github.com>
bradyhunsaker pushed a commit to bradyhunsaker/gtfs-validator that referenced this pull request Apr 25, 2023
…lityData#1345)

* Add a unit-test that enforces consistency of Notice field names by checking against an allow-list of existing field names.

Co-authored-by: David Gamez <1192523+davidgamez@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
3 participants