blob: e50616216fc27b23903f43036bf975f87934cb6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
from ..result import IssueEncoder
from .compact import CompactFormatter
from .stylish import StylishFormatter
from .summary import SummaryFormatter
from .treeherder import TreeherderFormatter
from .unix import UnixFormatter
class JSONFormatter(object):
def __call__(self, result):
return json.dumps(result.issues, cls=IssueEncoder)
all_formatters = {
"compact": CompactFormatter,
"json": JSONFormatter,
"stylish": StylishFormatter,
"summary": SummaryFormatter,
"treeherder": TreeherderFormatter,
"unix": UnixFormatter,
}
def get(name, **fmtargs):
return all_formatters[name](**fmtargs)
|