[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    quality/cppchecks/xmltodb
From:       Bertjan Broeksema <b.broeksema () home ! nl>
Date:       2009-07-20 14:18:10
Message-ID: 1248099490.738342.14121.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 999865 by bbroeksema:

Try a bit harder to find the plugin name from krazy2 output. It has the name of
the plugin in the @desc parameter in stead of @name.

Don't bail out when a result for a non-registered plugin is found, just skip it.


 D             CMakeLists.txt.user  
 M  +20 -6     toolrunresultparser.cpp  


--- trunk/quality/cppchecks/xmltodb/toolrunresultparser.cpp #999864:999865
@@ -1,5 +1,6 @@
 #include "toolrunresultparser.h"
 
+#include <QtCore/QDebug>
 #include <QtCore/QDir>
 
 #include "database.h"
@@ -32,23 +33,36 @@
     for (int j = 0; j < checkCount; ++j) {
       QString checkPath = path + "check[" + QString::number(j + 1) + "]/";
       QString checkName = mDocument->readString(checkPath + "string(@name)");
+      if (checkName.isEmpty()) {
+        // Try harder to find a checkname
+        QString desc = mDocument->readString(checkPath + "string(@desc)");
+        Q_ASSERT(!desc.isEmpty());
 
+        QRegExp exp("\\[(\\w+)\\]");
+        Q_ASSERT(exp.indexIn(desc) != -1);
+
+        checkName = exp.cap(1);
+      }
+
       int fileCount = mDocument->count(checkPath + "file");
       for (int k = 0; k < fileCount; ++k) {
         QString filePath = checkPath + "file[" + QString::number(k + 1) + "]/";
 
         QString fileName = mDocument->readString(filePath + "string(@name)");
         QFileInfo file(fileName);
-        fileName = file.absoluteFilePath();
-        fileName = strip(fileName);
+        if (file.isAbsolute())
+          fileName = strip(fileName);
 
         int issueCount = mDocument->count(filePath + "issues/line");
         if (issueCount > 0 && !fileName.startsWith(mModule)) {
-          Q_ASSERT(mTool.plugin(checkName).name() == checkName);
-          qlonglong pluginId = mTool.plugin(checkName).id();
-          qlonglong fileId = database->registerFile(mModule, mSubModule, fileName, fileType);
-          database->registerFileResult(fileId, mComponentCheckId, pluginId, issueCount);
+          if (mTool.plugin(checkName).name() != checkName) {
+            qDebug() << "Plugin:" << checkName << "was not registered, ignoring.";
+          } else {
+            qlonglong pluginId = mTool.plugin(checkName).id();
+            qlonglong fileId = database->registerFile(mModule, mSubModule, fileName, fileType);
+            database->registerFileResult(fileId, mComponentCheckId, pluginId, issueCount);
         }
+        }
       }
     }
   }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic