Lines 330-335
def format_qa_output(formatter, stats, fails, dofull, dofail, options, qawarning
Link Here
|
330 |
formatter.add_line_break() |
330 |
formatter.add_line_break() |
331 |
|
331 |
|
332 |
|
332 |
|
|
|
333 |
def format_qa_output_machine_parseable(formatter, stats, fails, dofull, dofail, options, qawarnings): |
334 |
"""Helper function that formats output in a machine-parseable column format |
335 |
|
336 |
Args: |
337 |
formatter - a subclass of Formatter |
338 |
stats - a dict of qa status items |
339 |
fails - a dict of qa status failures |
340 |
dofull - boolean to print full results or a summary |
341 |
dofail - boolean to decide if failure was hard or soft |
342 |
|
343 |
Returns: |
344 |
None (modifies formatter) |
345 |
""" |
346 |
full = options.mode == 'full' |
347 |
# we only want key value pairs where value > 0 |
348 |
for category, number in \ |
349 |
filter(lambda myitem: myitem[1] > 0, iter(stats.items())): |
350 |
|
351 |
formatter.add_literal_data("NumberOf " + category + " ") |
352 |
if category in qawarnings: |
353 |
formatter.push_style("WARN") |
354 |
else: |
355 |
formatter.push_style("BAD") |
356 |
formatter.add_literal_data("%s" % number) |
357 |
formatter.pop_style() |
358 |
formatter.add_line_break() |
359 |
if not dofull: |
360 |
if not full and dofail and category in qawarnings: |
361 |
# warnings are considered noise when there are failures |
362 |
continue |
363 |
fails_list = fails[category] |
364 |
if not full and len(fails_list) > 12: |
365 |
fails_list = fails_list[:12] |
366 |
for failure in fails_list: |
367 |
formatter.add_literal_data(category + " " + failure) |
368 |
formatter.add_line_break() |
369 |
|
333 |
def editor_is_executable(editor): |
370 |
def editor_is_executable(editor): |
334 |
""" |
371 |
""" |
335 |
Given an EDITOR string, validate that it refers to |
372 |
Given an EDITOR string, validate that it refers to |