(error_tuples: list[ErrorTuple])
| 1428 | |
| 1429 | |
| 1430 | def create_errors(error_tuples: list[ErrorTuple]) -> list[MypyError]: |
| 1431 | errors: list[MypyError] = [] |
| 1432 | latest_error_at_location: dict[_ErrorLocation, MypyError] = {} |
| 1433 | |
| 1434 | for error_tuple in error_tuples: |
| 1435 | file_path, line, column, end_line, end_column, severity, message, errorcode = error_tuple |
| 1436 | if file_path is None: |
| 1437 | continue |
| 1438 | |
| 1439 | assert severity in ("error", "note") |
| 1440 | if severity == "note": |
| 1441 | error_location = (file_path, line, column) |
| 1442 | error = latest_error_at_location.get(error_location) |
| 1443 | if error is None: |
| 1444 | # This is purely a note, with no error correlated to it |
| 1445 | error = MypyError( |
| 1446 | file_path, |
| 1447 | line, |
| 1448 | column, |
| 1449 | end_line, |
| 1450 | end_column, |
| 1451 | message, |
| 1452 | errorcode, |
| 1453 | severity="note", |
| 1454 | ) |
| 1455 | errors.append(error) |
| 1456 | continue |
| 1457 | |
| 1458 | error.hints.append(message) |
| 1459 | |
| 1460 | else: |
| 1461 | error = MypyError( |
| 1462 | file_path, line, column, end_line, end_column, message, errorcode, severity="error" |
| 1463 | ) |
| 1464 | errors.append(error) |
| 1465 | error_location = (file_path, line, column) |
| 1466 | latest_error_at_location[error_location] = error |
| 1467 | |
| 1468 | return errors |
no test coverage detected
searching dependent graphs…