MCPcopy Index your code
hub / github.com/python/mypy / report_error

Method report_error

mypy/error_formatter.py:22–36  ·  view source on GitHub ↗

Prints out the errors as simple, static JSON lines.

(self, error: "MypyError")

Source from the content-addressed store, hash-verified

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
39OUTPUT_CHOICES = {"json": JSONFormatter()}

Callers 1

format_messagesMethod · 0.45

Calls 3

lenFunction · 0.85
dumpsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected