@@ -70,8 +70,6 @@ def check_file_txt(self, path):
7070 Error and warning list items are tuples:
7171 (line_number, line_text, message)
7272 """
73- filename = os .path .basename (path )
74- result = {}
7573 items = []
7674 errors = 0
7775 warnings = 0
@@ -111,16 +109,9 @@ def check_file_txt(self, path):
111109 item += " " + line .strip ()
112110 else :
113111 pass
114- result [filename ] = {
115- "passed" : passed ,
116- "message" : message ,
117- "errors" : errors ,
118- "warnings" :warnings ,
119- "items" : items ,
120- }
112+ info = {'checker' : self .name , 'items' : [], 'code' : {}}
121113
122-
123- return passed , message , errors , warnings , result
114+ return passed , message , errors , warnings , info
124115
125116class DraftYangChecker (object ):
126117
@@ -137,10 +128,11 @@ def check_file_txt(self, path):
137128 results = []
138129 passed = True # Used by the submission tool. Yang checks always pass.
139130 model_list = []
131+ info = {'checker' : self .name , 'items' : [], 'code' : {}}
140132
141- extractor = xym .YangModuleExtractor (path , workdir , strict = True , strict_examples = False , debug_level = 0 )
133+ extractor = xym .YangModuleExtractor (path , workdir , strict = True , strict_examples = False , debug_level = 1 )
142134 if not os .path .exists (path ):
143- return None , "%s: No such file or directory: '%s'" % (name .capitalize (), path ), errors , warnings , results
135+ return None , "%s: No such file or directory: '%s'" % (name .capitalize (), path ), errors , warnings , info
144136 with open (path ) as file :
145137 out = ""
146138 err = ""
@@ -161,11 +153,10 @@ def check_file_txt(self, path):
161153 except Exception as exc :
162154 msg = "Exception when running xym on %s: %s" % (name , exc )
163155 log (msg )
164- return None , msg , 0 , 0 , []
165-
156+ return None , msg , 0 , 0 , info
166157 if not model_list :
167- # Found no yang modules , don't deliver any YangChecker result
168- return None , "" , 0 , 0 , []
158+ # Found no yang models , don't deliver any YangChecker result
159+ return None , "" , 0 , 0 , info
169160
170161 for m in model_list :
171162 if not re .search (model_name_re , m ):
@@ -175,6 +166,8 @@ def check_file_txt(self, path):
175166 code += 1
176167 err += "Error: Multiple models with the same name:\n %s\n " % ("\n " .join (model_list ))
177168
169+ model_list = list (set (model_list ))
170+
178171 command = "xym"
179172 cmd_version = VersionInfo .objects .get (command = command ).version
180173 message = "%s:\n %s\n \n " % (cmd_version , out .replace ('\n \n ' ,'\n ' ).strip () if code == 0 else err )
@@ -188,7 +181,7 @@ def check_file_txt(self, path):
188181 "items" : [],
189182 })
190183
191- for model in set ( model_list ) :
184+ for model in model_list :
192185 path = os .path .join (workdir , model )
193186 message = ""
194187 modpath = ':' .join ([
@@ -277,6 +270,7 @@ def check_file_txt(self, path):
277270 errors = sum (res ["errors" ] for res in results )
278271 warnings = sum (res ["warnings" ] for res in results )
279272 items = [ e for res in results for e in res ["items" ] ]
280-
281- return passed , message , errors , warnings , items
273+ info ['items' ] = items
274+ info ['code' ]['yang' ] = model_list
275+ return passed , message , errors , warnings , info
282276
0 commit comments