Skip to content

refactor: distinguish between info, warning, and error notices#716

Merged
barbeau merged 18 commits intomasterfrom
errors-vs-warnings
Feb 4, 2021
Merged

refactor: distinguish between info, warning, and error notices#716
barbeau merged 18 commits intomasterfrom
errors-vs-warnings

Conversation

@lionel-nj
Copy link
Copy Markdown
Contributor

@lionel-nj lionel-nj commented Feb 2, 2021

closes #549

Summary:

This PR is a refactor proposal aimed at implementing the distinction between INFO, WARNING, and ERROR notices.

Expected behavior:

  • by default: SystemError severity level is set to SeverityLevel.ERROR
  • by default: ValidationNotice severity level is set to SeverityLevel.ERROR

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-" (PR title must follow the conventional commit specification)
  • Linked all relevant issues
  • [ ] Include screenshot(s) showing how this pull request works and fixes the issue(s)

@lionel-nj lionel-nj added this to the v2.0 milestone Feb 2, 2021
@lionel-nj lionel-nj self-assigned this Feb 2, 2021
# Conflicts:
#	core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NonAsciiOrNonPrintableCharNotice.java
#	core/src/test/java/org/mobilitydata/gtfsvalidator/parsing/RowParserTest.java
@lionel-nj lionel-nj changed the title Errors vs warnings refactor: distinguish errors/warning/system errors Feb 2, 2021
@lionel-nj
Copy link
Copy Markdown
Contributor Author

[WIP] Listing of errors/warnings/system errors: #709

Copy link
Copy Markdown
Collaborator

@aababilov aababilov left a comment

Choose a reason for hiding this comment

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

This is a good start! Thank you, Lionel.

lionel-nj added 3 commits February 3, 2021 14:39
- clarify javadocs
- reset Notice to unmutable elements:
  - remove setter
  - define 2 constructors for ValidationNotice class
- include SeverityLevel in .equals(), .toString() and .hashCode() methods from Notice class
@lionel-nj
Copy link
Copy Markdown
Contributor Author

Thanks @aababilov for your review! I modified the code and provided sample usage for SeverityLevel.INFO and SeverityLevel.WARNING.

@lionel-nj
Copy link
Copy Markdown
Contributor Author

I noticed that some notices can be used in different context (as ERROR or WARNING) e.g. MissingTripEdgeNotice which can be an error if stop_times.arrival_time is missing, or a warning if stop_times.departure_times is missing.

An arrival time must be specified for the first and the last stop in a trip.
http://gtfs.org/reference/static#stop_timestxt

Is providing two constructors for this kind of notice the right approach to this situation (as done in 156ccf5)?

@aababilov
Copy link
Copy Markdown
Collaborator

156ccf5 is very nice. We actually need just a single constructor that requires to provide severity explicitly, so that the caller never forgets to set it.

@aababilov
Copy link
Copy Markdown
Collaborator

aababilov commented Feb 4, 2021

Very good, ship it! And thanks!

@lionel-nj lionel-nj changed the title refactor: distinguish errors/warning/system errors refactor: distinguish between info, warning, and error notices Feb 4, 2021
lionel-nj added 2 commits February 4, 2021 12:59
@lionel-nj
Copy link
Copy Markdown
Contributor Author

Thanks @aababilov!

Copy link
Copy Markdown
Member

@barbeau barbeau left a comment

Choose a reason for hiding this comment

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

@lionel-nj Thanks for this, it mostly LGTM! A few corrections to typos and a comment in-line.

@lionel-nj lionel-nj requested a review from barbeau February 4, 2021 18:00
Copy link
Copy Markdown
Member

@barbeau barbeau left a comment

Choose a reason for hiding this comment

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

👍

@barbeau barbeau merged commit 9a0ca92 into master Feb 4, 2021
@barbeau barbeau deleted the errors-vs-warnings branch February 4, 2021 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distinguish between errors and warnings in notices

3 participants