feat: changed json format according to @adrienverge comment
This commit is contained in:
@@ -255,8 +255,23 @@ class JSONFormater(Formater):
|
|||||||
return list(map(self.show_problem, problems, [file] * len(problems)))
|
return list(map(self.show_problem, problems, [file] * len(problems)))
|
||||||
|
|
||||||
def show_problem(self, problem, file):
|
def show_problem(self, problem, file):
|
||||||
"""Show all problems of a specific file."""
|
"""Show all problems of a specific file.
|
||||||
return {**problem.dict, "path": file}
|
|
||||||
|
The desired format is:
|
||||||
|
|
||||||
|
>>> {
|
||||||
|
>>> "path": "dir/file.yaml",
|
||||||
|
>>> "line": 1337,
|
||||||
|
>>> "column": 42,
|
||||||
|
>>> "message": "duplication of key \"k\" in mapping",
|
||||||
|
>>> "rule": "key-duplicates",
|
||||||
|
>>> "level": "error"
|
||||||
|
>>> }
|
||||||
|
"""
|
||||||
|
dico = problem.dict
|
||||||
|
dico["message"] = dico.pop("desc")
|
||||||
|
dico["path"] = file
|
||||||
|
return dico
|
||||||
|
|
||||||
|
|
||||||
class JunitFormater(Formater):
|
class JunitFormater(Formater):
|
||||||
|
|||||||
Reference in New Issue
Block a user