Prints out the errors as simple, static JSON lines.
(self, error: "MypyError")
| 20 | """Formatter for basic JSON output format.""" |
| 21 | |
| 22 | def report_error(self, error: "MypyError") -> str: |
| 23 | """Prints out the errors as simple, static JSON lines.""" |
| 24 | return json.dumps( |
| 25 | { |
| 26 | "file": error.file_path, |
| 27 | "line": error.line, |
| 28 | "column": error.column, |
| 29 | "end_line": error.end_line, |
| 30 | "end_column": error.end_column, |
| 31 | "message": error.message, |
| 32 | "hint": None if len(error.hints) == 0 else "\n".join(error.hints), |
| 33 | "code": error.errorcode, |
| 34 | "severity": error.severity, |
| 35 | } |
| 36 | ) |
| 37 | |
| 38 | |
| 39 | OUTPUT_CHOICES = {"json": JSONFormatter()} |
no test coverage detected