1 |
On Thu, Feb 13, 2014 at 12:19 AM, Mike Frysinger <vapier@g.o> wrote: |
2 |
|
3 |
> On Monday, February 10, 2014 20:22:36 Chris Reffett wrote: |
4 |
> > This patch adds a --output-style option to repoman, which gives the user |
5 |
> > a choice of output formats for the repoman checks. Choices are "default" |
6 |
> > (current style) and "column" (a greppable format), but it should be easy |
7 |
> > to add more. Fixes bug 481584. |
8 |
> |
9 |
> i'd expect a proper structured output would make sense to include in the |
10 |
> default set. like JSON. just create a dict and send it to json.dump(). |
11 |
> |
12 |
|
13 |
He didn't want to, and I didn't want to make him ;) |
14 |
|
15 |
|
16 |
> |
17 |
> > v2: Fix docstring to be complete and in the standard format, make use of |
18 |
> > default choices in --output-style wrt comments by antarus and dol-sen |
19 |
> |
20 |
> erm, i thought the previous docstring was correct. it followed PEP257 |
21 |
> while |
22 |
> this new one is like javadoc or something. |
23 |
> |
24 |
> > -utilities.format_qa_output(f, stats, fails, dofull, dofail, options, |
25 |
> > qawarnings) |
26 |
> > +if options.output_style == 'column': |
27 |
> > + utilities.format_qa_output_column(f, stats, fails, dofull, dofail, |
28 |
> > options, qawarnings) |
29 |
> > +else: |
30 |
> > + utilities.format_qa_output(f, stats, fails, dofull, dofail, |
31 |
> options, |
32 |
> > qawarnings) |
33 |
> |
34 |
> use a func pointer instead. |
35 |
> format_outputs = { |
36 |
> 'column': utilities.format_qa_output_column, |
37 |
> 'default': utilities.format_qa_output, |
38 |
> } |
39 |
> format_output = format_outputs.get(options.output_style, |
40 |
> format_outputs['default']) |
41 |
> format_output(f, stats, fails, dofull, dofail, options, qawarnings) |
42 |
> |
43 |
> > + formatter.add_literal_data("NumberOf " + category + " ") |
44 |
> |
45 |
> prefer to use % rather than + like so: |
46 |
> 'NumberOf %s ' % category |
47 |
> |
48 |
> > + formatter.add_literal_data("%s" % number) |
49 |
> |
50 |
> str(number) |
51 |
> |
52 |
|
53 |
That is the definition of %s, no explicit str() is necessary. |
54 |
|
55 |
http://docs.python.org/2/library/stdtypes.html#string-formatting-operations |
56 |
|
57 |
|
58 |
> -mike |