triage tool: handle reports when cppcheck is run on local packages
This commit is contained in:
parent
67f46b7353
commit
883908b439
|
@ -99,6 +99,7 @@ void MainWindow::loadFromClipboard()
|
||||||
|
|
||||||
void MainWindow::load(QTextStream &textStream)
|
void MainWindow::load(QTextStream &textStream)
|
||||||
{
|
{
|
||||||
|
bool local = false;
|
||||||
QString url;
|
QString url;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
QStringList versions;
|
QStringList versions;
|
||||||
|
@ -107,21 +108,24 @@ void MainWindow::load(QTextStream &textStream)
|
||||||
QString line = textStream.readLine();
|
QString line = textStream.readLine();
|
||||||
if (line.isNull())
|
if (line.isNull())
|
||||||
break;
|
break;
|
||||||
if (line.startsWith("ftp://")) {
|
if (line.startsWith("ftp://") || (line.startsWith(DACA2_PACKAGES) && line.endsWith(".tar.xz"))) {
|
||||||
|
local = line.startsWith(DACA2_PACKAGES) && line.endsWith(".tar.xz");
|
||||||
url = line;
|
url = line;
|
||||||
if (!errorMessage.isEmpty())
|
if (!errorMessage.isEmpty())
|
||||||
mAllErrors << errorMessage;
|
mAllErrors << errorMessage;
|
||||||
errorMessage.clear();
|
errorMessage.clear();
|
||||||
} else if (!url.isEmpty()) {
|
} else if (!url.isEmpty()) {
|
||||||
static const QRegularExpression severityRe("^.*: (error|warning|style|note):.*$");
|
static const QRegularExpression severityRe("^.*: (error|warning|style|note):.*$");
|
||||||
if (severityRe.match(line).hasMatch())
|
if (!severityRe.match(line).hasMatch())
|
||||||
continue;
|
continue;
|
||||||
|
if (!local) {
|
||||||
const QRegularExpressionMatch matchRes = mVersionRe.match(line);
|
const QRegularExpressionMatch matchRes = mVersionRe.match(line);
|
||||||
if (matchRes.hasMatch()) {
|
if (matchRes.hasMatch()) {
|
||||||
const QString version = matchRes.captured(1);
|
const QString version = matchRes.captured(1);
|
||||||
if (versions.indexOf(version) < 0)
|
if (versions.indexOf(version) < 0)
|
||||||
versions << version;
|
versions << version;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (line.indexOf(": note:") > 0)
|
if (line.indexOf(": note:") > 0)
|
||||||
errorMessage += '\n' + line;
|
errorMessage += '\n' + line;
|
||||||
else if (errorMessage.isEmpty()) {
|
else if (errorMessage.isEmpty()) {
|
||||||
|
@ -259,16 +263,19 @@ bool MainWindow::unpackArchive(const QString &archiveName)
|
||||||
void MainWindow::showResult(QListWidgetItem *item)
|
void MainWindow::showResult(QListWidgetItem *item)
|
||||||
{
|
{
|
||||||
ui->statusBar->clearMessage();
|
ui->statusBar->clearMessage();
|
||||||
if (!item->text().startsWith("ftp://"))
|
const bool local = item->text().startsWith(DACA2_PACKAGES);
|
||||||
|
if (!item->text().startsWith("ftp://") && !local)
|
||||||
return;
|
return;
|
||||||
const QStringList lines = item->text().split("\n");
|
const QStringList lines = item->text().split("\n");
|
||||||
if (lines.size() < 2)
|
if (lines.size() < 2)
|
||||||
return;
|
return;
|
||||||
const QString &url = lines[0];
|
const QString &url = lines[0];
|
||||||
QString msg = lines[1];
|
QString msg = lines[1];
|
||||||
|
if (!local) {
|
||||||
const QRegularExpressionMatch matchRes = mVersionRe.match(msg);
|
const QRegularExpressionMatch matchRes = mVersionRe.match(msg);
|
||||||
if (matchRes.hasMatch())
|
if (matchRes.hasMatch())
|
||||||
msg = matchRes.captured(2);
|
msg = matchRes.captured(2);
|
||||||
|
}
|
||||||
const QString archiveName = url.mid(url.lastIndexOf("/") + 1);
|
const QString archiveName = url.mid(url.lastIndexOf("/") + 1);
|
||||||
const int pos1 = msg.indexOf(":");
|
const int pos1 = msg.indexOf(":");
|
||||||
const int pos2 = msg.indexOf(":", pos1+1);
|
const int pos2 = msg.indexOf(":", pos1+1);
|
||||||
|
@ -280,7 +287,7 @@ void MainWindow::showResult(QListWidgetItem *item)
|
||||||
if (QFileInfo::exists(daca2archiveFile)) {
|
if (QFileInfo::exists(daca2archiveFile)) {
|
||||||
if (!unpackArchive(daca2archiveFile))
|
if (!unpackArchive(daca2archiveFile))
|
||||||
return;
|
return;
|
||||||
} else {
|
} else if (!local) {
|
||||||
const QString archiveFullPath {WORK_FOLDER + '/' + archiveName};
|
const QString archiveFullPath {WORK_FOLDER + '/' + archiveName};
|
||||||
if (!QFileInfo::exists(archiveFullPath)) {
|
if (!QFileInfo::exists(archiveFullPath)) {
|
||||||
// Download archive
|
// Download archive
|
||||||
|
|
Loading…
Reference in New Issue