File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,36 @@ def run_validation(self):
173
173
for prop in sec .properties :
174
174
self .validate (prop )
175
175
176
+ def report (self ):
177
+ """
178
+ Validates the registered object and returns a results report.
179
+ """
180
+ self .run_validation ()
181
+
182
+ err_count = 0
183
+ reduce = set ()
184
+ sec_count = 0
185
+ prop_count = 0
186
+
187
+ for i in self .errors :
188
+ if i .is_error :
189
+ err_count += 1
190
+
191
+ if i .obj not in reduce and 'section' in str (i .obj ).lower ():
192
+ sec_count += 1
193
+ elif i .obj not in reduce and 'property' in str (i .obj ).lower ():
194
+ prop_count += 1
195
+
196
+ reduce .add (i .obj )
197
+
198
+ warn_count = len (self .errors ) - err_count
199
+ msg = ""
200
+ if err_count or warn_count :
201
+ msg = "Validation found %s errors and %s warnings" % (err_count , warn_count )
202
+ msg += " in %s Sections and %s Properties." % (sec_count , prop_count )
203
+
204
+ return msg
205
+
176
206
def register_custom_handler (self , klass , handler ):
177
207
"""
178
208
Adds a validation handler for an odml class. The handler is called in the
You can’t perform that action at this time.
0 commit comments