Skip to content

Commit aaac777

Browse files
committed
[validation.py] Add Object Name Readability Check
For Section and Property.
1 parent 56e12fe commit aaac777

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

odml/validation.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,20 @@ def property_unique_names(obj):
308308
Validation.register_handler('section', property_unique_names)
309309

310310

311+
def object_name_readable(obj):
312+
"""
313+
Tests if object name is easily readable, so not equal to id.
314+
315+
:param obj: odml.Section or odml.Property.
316+
"""
317+
if obj.name == obj.id:
318+
yield ValidationError(obj, 'Name should be readable', LABEL_WARNING)
319+
320+
321+
Validation.register_handler('section', object_name_readable)
322+
Validation.register_handler('property', object_name_readable)
323+
324+
311325
def property_terminology_check(prop):
312326
"""
313327
1. warn, if there are properties that do not occur in the terminology.

0 commit comments

Comments
 (0)