-
Notifications
You must be signed in to change notification settings - Fork 27
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
Validator part 2 #421
Validator part 2 #421
Conversation
- Renamed validate.py to validator.py - Validator module will simply be a collection of functions and not a class to instantiate with a file. There's no need to have an object.
Return the new style of results, which is a dictionary with two sub-dictionaries, one for errors and one for warnings.
Instead of returning a dictionary, each validation function (except check_file) returns a list of errors and a list of warnings for the provided object. None of the functions check objects recursively, but it may be necessary for Dimensions and Features.
Update tests as well
- Some conditionals were flipped - Empty string units in tags should be allowed
New helper function for checking Tag (and MultiTag) units against all the units in referenced DataArrays. Allows for the special case where both the Tag unit and the corresponding reference unit are empty strings.
Create fully valid file in test setUp() and create one error or warning per test.
Mostly the same as Tags, with differences in positions and extents checks.
Disable failing tests until they are rewritten
Can't test for the error now since the time can't be parsed by the lib.
This pull request introduces 5 alerts when merging 7b3c338 into d493d01 - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts and fixes 3 when merging 307dccd into d493d01 - view on LGTM.com new alerts:
fixed alerts:
|
This pull request introduces 3 alerts and fixes 3 when merging 305d795 into d493d01 - view on LGTM.com new alerts:
fixed alerts:
|
looks like we are caught in cycle here :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work, the static classes make it super clear, imho
I don't think the detected import cycles are real cycles. Pycycle doesn't seem to think so. I guess the issue detected is that EDIT: We could also drop the dimension type validation check since it's not really meaningful. The library initialises the Dimension object based on the |
This pull request introduces 3 alerts and fixes 3 when merging 5ed05de into d493d01 - view on LGTM.com new alerts:
fixed alerts:
|
Could the dimension type be invalid? Not when the file was created via the library at least. I vote for skipping the check. |
It's the same as with other kinds of invalid states (like not having an ID). The instantiation of the object will throw an exception, so there's way to have a Dimension object that's has an invalid dimtype. I'll include it in the next version that will be able to catch exceptions and report them as errors. |
The library initialises the Dimension object based on the dimension_type attribute when reading, so it's impossible for them to differ without the library throwing an exception on load.
This pull request fixes 3 alerts when merging a7fd01c into d493d01 - view on LGTM.com fixed alerts:
|
Did a bit of a cleanup and rewrite of the validator.
In a followup PR, I'll add a script so that the validator can be run from the command line.