MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / latestReport

Function latestReport

tools/donate-cpu-server.py:164–201  ·  view source on GitHub ↗
(latestResults: list)

Source from the content-addressed store, hash-verified

162
163
164def latestReport(latestResults: list) -> str:
165 html = '<!DOCTYPE html>\n'
166 html += '<html><head><title>Latest daca@home results</title></head><body>\n'
167 html += '<h1>Latest daca@home results</h1>\n'
168 html += '<pre>\n<b>' + fmt('Package', 'Date Time', OLD_VERSION, 'Head', 'Diff', link=False) + '</b>\n'
169
170 # Write report for latest results
171 for filename in latestResults:
172 if not os.path.isfile(filename):
173 continue
174 package = pkg_from_file(filename)
175 current_year = datetime.date.today().year
176
177 datestr = None
178 count = ['0', '0']
179 lost = 0
180 added = 0
181 for line in open(filename, 'rt'):
182 line = line.strip()
183 if datestr is None and line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
184 datestr = line
185 #elif line.startswith('cppcheck:'):
186 # cppcheck = line[9:]
187 elif line.startswith('count: '):
188 count = line.split(' ')[1:]
189 elif line.startswith('head ') and not line.startswith('head results:'):
190 added += 1
191 elif line.startswith(OLD_VERSION + ' '):
192 lost += 1
193 diff = ''
194 if lost > 0:
195 diff += '-' + str(lost)
196 if added > 0:
197 diff += '+' + str(added)
198 html += fmt(package, datestr, count[1], count[0], diff) + '\n'
199
200 html += '</pre></body></html>\n'
201 return html
202
203
204def crashReport(results_path: str, query_params: dict):

Callers 1

runMethod · 0.85

Calls 3

fmtFunction · 0.85
pkg_from_fileFunction · 0.85
strFunction · 0.85

Tested by

no test coverage detected