| 49 | } |
| 50 | |
| 51 | void TxtReport::writeError(const ErrorItem &error) |
| 52 | { |
| 53 | /* |
| 54 | Error example from the core program in text |
| 55 | [gui/test.cpp:23] -> [gui/test.cpp:14]: (error) Mismatching allocation and deallocation: k |
| 56 | */ |
| 57 | |
| 58 | QString line; |
| 59 | |
| 60 | for (int i = 0; i < error.errorPath.size(); i++) { |
| 61 | const QString file = QDir::toNativeSeparators(error.errorPath[i].file); |
| 62 | line += QString("[%1:%2]").arg(file).arg(error.errorPath[i].line); |
| 63 | if (i < error.errorPath.size() - 1) { |
| 64 | line += " -> "; |
| 65 | } |
| 66 | |
| 67 | if (i == error.errorPath.size() - 1) { |
| 68 | line += ": "; |
| 69 | } |
| 70 | } |
| 71 | QString temp = "(%1"; |
| 72 | if (error.inconclusive) { |
| 73 | temp += ", "; |
| 74 | temp += tr("inconclusive"); |
| 75 | } |
| 76 | temp += ") "; |
| 77 | line += temp.arg(GuiSeverity::toString(error.severity)); |
| 78 | line += error.summary; |
| 79 | |
| 80 | mTxtWriter << line << Qt::endl; |
| 81 | } |
no test coverage detected