Make validation errors immutable #610
Labels
category: enhancement
improvements of code or code behavior
topic: validator
issues related to validation of files
In #609 (assuming some version of it is accepted), eq and hash functions were defined for validation Errors in order to make them comparable. Equality is based on the name, reason, and location attributes, however the location attribute is mutable which means that the hash value could change if the location value is changed. This opens the door for potential bugs in the future.
Instead, it would be better to make Errors immutable, or at least remove the setter for location.
This will require an update to the way attribute validation errors are created, as they use the location setter.
Is your feature request related to a problem? Please describe.
No, this is not an existing problem, but the current implementation leaves opportunities for bugs and is more complex.
Describe the solution you'd like
Describe alternatives you've considered
Remove the hash implementation for Error and refactor GroupValidator._remove_duplicates to not require a hashable object.
Additional context
Ref: #528
Checklist
The text was updated successfully, but these errors were encountered: