1 |
On Monday, February 10, 2014 20:22:36 Chris Reffett wrote: |
2 |
> This patch adds a --output-style option to repoman, which gives the user |
3 |
> a choice of output formats for the repoman checks. Choices are "default" |
4 |
> (current style) and "column" (a greppable format), but it should be easy |
5 |
> to add more. Fixes bug 481584. |
6 |
|
7 |
i'd expect a proper structured output would make sense to include in the |
8 |
default set. like JSON. just create a dict and send it to json.dump(). |
9 |
|
10 |
> v2: Fix docstring to be complete and in the standard format, make use of |
11 |
> default choices in --output-style wrt comments by antarus and dol-sen |
12 |
|
13 |
erm, i thought the previous docstring was correct. it followed PEP257 while |
14 |
this new one is like javadoc or something. |
15 |
|
16 |
> -utilities.format_qa_output(f, stats, fails, dofull, dofail, options, |
17 |
> qawarnings) |
18 |
> +if options.output_style == 'column': |
19 |
> + utilities.format_qa_output_column(f, stats, fails, dofull, dofail, |
20 |
> options, qawarnings) |
21 |
> +else: |
22 |
> + utilities.format_qa_output(f, stats, fails, dofull, dofail, options, |
23 |
> qawarnings) |
24 |
|
25 |
use a func pointer instead. |
26 |
format_outputs = { |
27 |
'column': utilities.format_qa_output_column, |
28 |
'default': utilities.format_qa_output, |
29 |
} |
30 |
format_output = format_outputs.get(options.output_style, |
31 |
format_outputs['default']) |
32 |
format_output(f, stats, fails, dofull, dofail, options, qawarnings) |
33 |
|
34 |
> + formatter.add_literal_data("NumberOf " + category + " ") |
35 |
|
36 |
prefer to use % rather than + like so: |
37 |
'NumberOf %s ' % category |
38 |
|
39 |
> + formatter.add_literal_data("%s" % number) |
40 |
|
41 |
str(number) |
42 |
-mike |