Skip to content

Commit 4ab04db

Browse files
committed
Rename 'cppcheckID' to 'hash'
1 parent ae0ad17 commit 4ab04db

14 files changed

Lines changed: 80 additions & 80 deletions

cppcheck-errors.rng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</attribute>
2626
</optional>
2727
<optional>
28-
<attribute name="cppcheck-id">
28+
<attribute name="hash">
2929
<data type="integer">
3030
<param name="minExclusive">1</param>
3131
</data>

gui/erroritem.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ErrorItem::ErrorItem()
3737
, incomplete(false)
3838
, inconclusive(false)
3939
, cwe(-1)
40-
, cppcheckId(0)
40+
, hash(0)
4141
{
4242
}
4343

@@ -51,7 +51,7 @@ ErrorItem::ErrorItem(const ErrorMessage &errmsg)
5151
, summary(QString::fromStdString(errmsg.shortMessage()))
5252
, message(QString::fromStdString(errmsg.verboseMessage()))
5353
, cwe(errmsg.cwe.id)
54-
, cppcheckId(errmsg.cppcheckId)
54+
, hash(errmsg.hash)
5555
, symbolNames(QString::fromStdString(errmsg.symbolNames()))
5656
{
5757
for (std::list<ErrorMessage::FileLocation>::const_iterator loc = errmsg.callStack.begin();
@@ -88,8 +88,8 @@ QString ErrorItem::toString() const
8888

8989
bool ErrorItem::sameCID(const ErrorItem &errorItem1, const ErrorItem &errorItem2)
9090
{
91-
if (errorItem1.cppcheckId || errorItem2.cppcheckId)
92-
return errorItem1.cppcheckId == errorItem2.cppcheckId;
91+
if (errorItem1.hash || errorItem2.hash)
92+
return errorItem1.hash == errorItem2.hash;
9393

9494
// fallback
9595
return errorItem1.errorId == errorItem2.errorId &&

gui/erroritem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ErrorItem {
8888
QString summary;
8989
QString message;
9090
int cwe;
91-
unsigned long long cppcheckId;
91+
unsigned long long hash;
9292
QList<QErrorPathItem> errorPath;
9393
QString symbolNames;
9494

@@ -115,7 +115,7 @@ class ErrorLine {
115115
QString errorId;
116116
bool incomplete;
117117
int cwe;
118-
unsigned long long cppcheckId;
118+
unsigned long long hash;
119119
bool inconclusive;
120120
Severity::SeverityType severity;
121121
QString summary;

gui/projectfile.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,8 @@ void ProjectFile::readSuppressions(QXmlStreamReader &reader)
610610
suppression.lineNumber = reader.attributes().value(QString(),"lineNumber").toInt();
611611
if (reader.attributes().hasAttribute(QString(),"symbolName"))
612612
suppression.symbolName = reader.attributes().value(QString(),"symbolName").toString().toStdString();
613-
if (reader.attributes().hasAttribute(QString(),"cppcheck-id"))
614-
suppression.cppcheckId = reader.attributes().value(QString(),"cppcheck-id").toULongLong();
613+
if (reader.attributes().hasAttribute(QString(),"hash"))
614+
suppression.hash = reader.attributes().value(QString(),"hash").toULongLong();
615615
type = reader.readNext();
616616
if (type == QXmlStreamReader::Characters) {
617617
suppression.errorId = reader.text().toString().toStdString();
@@ -650,8 +650,8 @@ void ProjectFile::readTagWarnings(QXmlStreamReader &reader, const QString &tag)
650650
case QXmlStreamReader::StartElement:
651651
// Read library-elements
652652
if (reader.name().toString() == CppcheckXml::WarningElementName) {
653-
std::size_t cppcheckId = reader.attributes().value(QString(), CppcheckXml::CppcheckIdAttributeName).toULongLong();
654-
mWarningTags[cppcheckId] = tag;
653+
std::size_t hash = reader.attributes().value(QString(), CppcheckXml::HashAttributeName).toULongLong();
654+
mWarningTags[hash] = tag;
655655
}
656656
break;
657657

@@ -774,17 +774,17 @@ void ProjectFile::setVSConfigurations(const QStringList &vsConfigs)
774774
mVsConfigurations = vsConfigs;
775775
}
776776

777-
void ProjectFile::setWarningTags(std::size_t cppcheckId, QString tag)
777+
void ProjectFile::setWarningTags(std::size_t hash, QString tag)
778778
{
779779
if (tag.isEmpty())
780-
mWarningTags.erase(cppcheckId);
781-
else if (cppcheckId > 0)
782-
mWarningTags[cppcheckId] = tag;
780+
mWarningTags.erase(hash);
781+
else if (hash > 0)
782+
mWarningTags[hash] = tag;
783783
}
784784

785-
QString ProjectFile::getWarningTags(std::size_t cppcheckId) const
785+
QString ProjectFile::getWarningTags(std::size_t hash) const
786786
{
787-
auto it = mWarningTags.find(cppcheckId);
787+
auto it = mWarningTags.find(hash);
788788
return (it != mWarningTags.end()) ? it->second : QString();
789789
}
790790

@@ -936,8 +936,8 @@ bool ProjectFile::write(const QString &filename)
936936
xmlWriter.writeAttribute("lineNumber", QString::number(suppression.lineNumber));
937937
if (!suppression.symbolName.empty())
938938
xmlWriter.writeAttribute("symbolName", QString::fromStdString(suppression.symbolName));
939-
if (suppression.cppcheckId > 0)
940-
xmlWriter.writeAttribute(CppcheckXml::CppcheckIdAttributeName, QString::number(suppression.cppcheckId));
939+
if (suppression.hash > 0)
940+
xmlWriter.writeAttribute(CppcheckXml::HashAttributeName, QString::number(suppression.hash));
941941
if (!suppression.errorId.empty())
942942
xmlWriter.writeCharacters(QString::fromStdString(suppression.errorId));
943943
xmlWriter.writeEndElement();
@@ -981,7 +981,7 @@ bool ProjectFile::write(const QString &filename)
981981
for (const auto wt: mWarningTags) {
982982
if (wt.second == tag) {
983983
xmlWriter.writeStartElement(CppcheckXml::WarningElementName);
984-
xmlWriter.writeAttribute(CppcheckXml::CppcheckIdAttributeName, QString::number(wt.first));
984+
xmlWriter.writeAttribute(CppcheckXml::HashAttributeName, QString::number(wt.first));
985985
xmlWriter.writeEndElement();
986986
}
987987
}

gui/projectfile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ class ProjectFile : public QObject {
332332
}
333333

334334
/** Set tags for a warning */
335-
void setWarningTags(std::size_t cppcheckId, QString tags);
335+
void setWarningTags(std::size_t hash, QString tags);
336336

337337
/** Get tags for a warning */
338-
QString getWarningTags(std::size_t cppcheckId) const;
338+
QString getWarningTags(std::size_t hash) const;
339339

340340
/**
341341
* @brief Write project file (to disk).

gui/resultstree.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
#include "xmlreportv2.h"
5151

5252
static const char COLUMN[] = "column";
53-
static const char CPPCHECKID[] = "cppcheckId";
5453
static const char CWE[] = "cwe";
5554
static const char ERRORID[] = "id";
5655
static const char FILENAME[] = "file";
5756
static const char FILE0[] = "file0";
5857
static const char FUNCTION[] = "function";
58+
static const char HASH[] = "hash";
5959
static const char HIDE[] = "hide";
6060
static const char INCOMPLETE[] = "incomplete";
6161
static const char INCONCLUSIVE[] = "inconclusive";
@@ -187,14 +187,14 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
187187
line.errorId = item.errorId;
188188
line.incomplete = item.incomplete;
189189
line.cwe = item.cwe;
190-
line.cppcheckId = item.cppcheckId;
190+
line.hash = item.hash;
191191
line.inconclusive = item.inconclusive;
192192
line.summary = item.summary;
193193
line.message = item.message;
194194
line.severity = item.severity;
195195
line.sinceDate = item.sinceDate;
196196
if (const ProjectFile *activeProject = ProjectFile::getActiveProject()) {
197-
line.tags = activeProject->getWarningTags(item.cppcheckId);
197+
line.tags = activeProject->getWarningTags(item.hash);
198198
}
199199
//Create the base item for the error and ensure it has a proper
200200
//file item as a parent
@@ -219,7 +219,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
219219
data[ERRORID] = item.errorId;
220220
data[INCOMPLETE] = item.incomplete;
221221
data[CWE] = item.cwe;
222-
data[CPPCHECKID] = item.cppcheckId;
222+
data[HASH] = item.hash;
223223
data[INCONCLUSIVE] = item.inconclusive;
224224
data[FILE0] = stripPath(item.file0, true);
225225
data[FUNCTION] = item.function;
@@ -256,7 +256,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
256256
child_data[ERRORID] = line.errorId;
257257
child_data[INCOMPLETE] = line.incomplete;
258258
child_data[CWE] = line.cwe;
259-
child_data[CPPCHECKID] = line.cppcheckId;
259+
child_data[HASH] = line.hash;
260260
child_data[INCONCLUSIVE] = line.inconclusive;
261261
child_data[SYMBOLNAMES] = item.symbolNames;
262262
child_item->setData(QVariant(child_data));
@@ -661,7 +661,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
661661
QAction *copy = new QAction(tr("Copy"), &menu);
662662
QAction *hide = new QAction(tr("Hide"), &menu);
663663
QAction *hideallid = new QAction(tr("Hide all with id"), &menu);
664-
QAction *suppressCppcheckID = new QAction(tr("Suppress cppcheck-id"), &menu);
664+
QAction *suppresshash = new QAction(tr("Suppress hash"), &menu);
665665
QAction *opencontainingfolder = new QAction(tr("Open containing folder"), &menu);
666666

667667
if (multipleSelection) {
@@ -679,7 +679,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
679679
menu.addSeparator();
680680
menu.addAction(hide);
681681
menu.addAction(hideallid);
682-
menu.addAction(suppressCppcheckID);
682+
menu.addAction(suppresshash);
683683
if (!bughunting) {
684684
QAction *suppress = new QAction(tr("Suppress selected id(s)"), &menu);
685685
menu.addAction(suppress);
@@ -692,7 +692,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
692692
connect(copy, SIGNAL(triggered()), this, SLOT(copy()));
693693
connect(hide, SIGNAL(triggered()), this, SLOT(hideResult()));
694694
connect(hideallid, SIGNAL(triggered()), this, SLOT(hideAllIdResult()));
695-
connect(suppressCppcheckID, &QAction::triggered, this, &ResultsTree::suppressCppcheckID);
695+
connect(suppresshash, &QAction::triggered, this, &ResultsTree::suppressHash);
696696
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()));
697697

698698
const ProjectFile *currentProject = ProjectFile::getActiveProject();
@@ -1066,7 +1066,7 @@ void ResultsTree::suppressSelectedIds()
10661066
emit suppressIds(selectedIds.toList());
10671067
}
10681068

1069-
void ResultsTree::suppressCppcheckID()
1069+
void ResultsTree::suppressHash()
10701070
{
10711071
if (!mSelectionModel)
10721072
return;
@@ -1087,9 +1087,9 @@ void ResultsTree::suppressCppcheckID()
10871087
for (QStandardItem *item: selectedWarnings) {
10881088
QStandardItem *fileItem = item->parent();
10891089
const QVariantMap data = item->data().toMap();
1090-
if (projectFile && data.contains("cppcheckId")) {
1090+
if (projectFile && data.contains(HASH)) {
10911091
Suppressions::Suppression suppression;
1092-
suppression.cppcheckId = data[CPPCHECKID].toULongLong();
1092+
suppression.hash = data[HASH].toULongLong();
10931093
suppression.errorId = data[ERRORID].toString().toStdString();
10941094
suppression.fileName = data[FILENAME].toString().toStdString();
10951095
suppression.lineNumber = data[LINE].toInt();
@@ -1132,9 +1132,9 @@ void ResultsTree::tagSelectedItems(const QString &tag)
11321132
data[TAGS] = tag;
11331133
item->setData(QVariant(data));
11341134
item->parent()->child(index.row(), COLUMN_TAGS)->setText(tag);
1135-
if (currentProject && data.contains(CPPCHECKID)) {
1135+
if (currentProject && data.contains(HASH)) {
11361136
isTagged = true;
1137-
currentProject->setWarningTags(data[CPPCHECKID].toULongLong(), tag);
1137+
currentProject->setWarningTags(data[HASH].toULongLong(), tag);
11381138
}
11391139
}
11401140
}
@@ -1296,7 +1296,7 @@ void ResultsTree::readErrorItem(const QStandardItem *error, ErrorItem *item) con
12961296
item->errorId = data[ERRORID].toString();
12971297
item->incomplete = data[INCOMPLETE].toBool();
12981298
item->cwe = data[CWE].toInt();
1299-
item->cppcheckId = data[CPPCHECKID].toULongLong();
1299+
item->hash = data[HASH].toULongLong();
13001300
item->inconclusive = data[INCONCLUSIVE].toBool();
13011301
item->file0 = data[FILE0].toString();
13021302
item->sinceDate = data[SINCEDATE].toString();

gui/resultstree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ protected slots:
276276
/** Slot for context menu item to suppress all messages with the current message id */
277277
void suppressSelectedIds();
278278

279-
/** Slot for context menu item to suppress message with cppcheck ID */
280-
void suppressCppcheckID();
279+
/** Slot for context menu item to suppress message with hash */
280+
void suppressHash();
281281

282282
/**
283283
* @brief Slot for context menu item to open the folder containing the current file.

gui/xmlreportv2.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static const QString ErrorElementName = "error";
3434
static const QString ErrorsElementName = "errors";
3535
static const QString LocationElementName = "location";
3636
static const QString CWEAttribute = "cwe";
37-
static const QString CppcheckIdAttribute = "cppcheck-id";
37+
static const QString HashAttribute = "hash";
3838
static const QString SinceDateAttribute = "sinceDate";
3939
static const QString TagsAttribute = "tag";
4040
static const QString FilenameAttribute = "file";
@@ -123,8 +123,8 @@ void XmlReportV2::writeError(const ErrorItem &error)
123123
mXmlWriter->writeAttribute(InconclusiveAttribute, "true");
124124
if (error.cwe > 0)
125125
mXmlWriter->writeAttribute(CWEAttribute, QString::number(error.cwe));
126-
if (error.cppcheckId > 0)
127-
mXmlWriter->writeAttribute(CppcheckIdAttribute, QString::number(error.cppcheckId));
126+
if (error.hash > 0)
127+
mXmlWriter->writeAttribute(HashAttribute, QString::number(error.hash));
128128
if (!error.sinceDate.isEmpty())
129129
mXmlWriter->writeAttribute(SinceDateAttribute, error.sinceDate);
130130
if (!error.tags.isEmpty())
@@ -218,8 +218,8 @@ ErrorItem XmlReportV2::readError(QXmlStreamReader *reader)
218218
item.inconclusive = true;
219219
if (attribs.hasAttribute(QString(), CWEAttribute))
220220
item.cwe = attribs.value(QString(), CWEAttribute).toInt();
221-
if (attribs.hasAttribute(QString(), CppcheckIdAttribute))
222-
item.cppcheckId = attribs.value(QString(), CppcheckIdAttribute).toULongLong();
221+
if (attribs.hasAttribute(QString(), HashAttribute))
222+
item.hash = attribs.value(QString(), HashAttribute).toULongLong();
223223
if (attribs.hasAttribute(QString(), SinceDateAttribute))
224224
item.sinceDate = attribs.value(QString(), SinceDateAttribute).toString();
225225
if (attribs.hasAttribute(QString(), TagsAttribute))

0 commit comments

Comments
 (0)