-
Notifications
You must be signed in to change notification settings - Fork 30
Refactor validator return type to support warnings via ValidationResult wrapper (#1479) #1480
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
Open
sejalpunwatkar
wants to merge
15
commits into
hdmf-dev:dev
Choose a base branch
from
sejalpunwatkar:feature/1479-validation-result
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
885f7a1
Refactor validator return type to support warnings via ValidationResu…
sejalpunwatkar 8e46bd4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 3ee3ea3
Merge branch 'dev' into feature/1479-validation-result
rly c1225d4
Update docstring and import for ValidationResult in common init
sejalpunwatkar 39499cf
Resolve merge conflicts and clean up validator tests
sejalpunwatkar 669261e
style: resolve ruff line length check on test imports
sejalpunwatkar 88bb8e9
style: fix ruff F811 duplicate import redefinition error
sejalpunwatkar 964acbf
Fix PR feedback, update ValidationWarning equality, and test structure
sejalpunwatkar 6670324
Merge branch 'dev' into feature/1479-validation-result
sejalpunwatkar 6b88ba9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] c0b0464
Add data type attribute to test builder setup
sejalpunwatkar 9eff3b4
Merge branch 'dev' into feature/1479-validation-result
rly f756b03
Merge branch 'dev' into feature/1479-validation-result
rly eeb2975
Apply suggestion from @rly
rly d687dd3
Update __init__.py
sejalpunwatkar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Since
ValidationWarningis almost entirely identical toError, it would be better to create a shared base classValidationIssuethat both extend from and that contains all the shared code. Downstream code will still be able to differentiate betweenErrorandValidationWarningbecause they are different classes.One minor thing is that because
__eq__is defined based on the hash and I believe the hash of aValidationWarningand the hash of an identicalErrorobject will be the same, thenError("name", "reason") == ValidationWarning("name", "reason")will be True. This might become an issue if/when errors and warnings are placed in a dict together.To address this, I would change
__eq__to: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.
Thanks for the below change to
ValidationWarning.__eq__.Since
ValidationWarningandErrorshare significant code, could you also create a shared base classValidationIssuethat both extend from and that contains all the shared code? That would also makeError.__eq__matchValidationWarning.__eq__, which it should.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.
With these changes, could you also add a quick test that an error and warning with the same name are not equal, so that these changed lines are tested?