Skip to content

Commit 2d9a131

Browse files
committed
Refactoring: Rename variables. Do not use leading _. Renamed 'col' to 'column'
1 parent 5f2379f commit 2d9a131

22 files changed

Lines changed: 187 additions & 187 deletions

addons/cppcheckdata.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Directive:
3434
str = None
3535
file = None
3636
linenr = None
37-
col = 0
37+
column = 0
3838

3939
def __init__(self, element):
4040
self.str = element.get('str')
@@ -131,7 +131,7 @@ class Token:
131131
astOperand2 ast operand2
132132
file file name
133133
linenr line number
134-
col column
134+
column column
135135
136136
To iterate through all tokens use such code:
137137
@code
@@ -188,7 +188,7 @@ class Token:
188188

189189
file = None
190190
linenr = None
191-
col = None
191+
column = None
192192

193193
def __init__(self, element):
194194
self.Id = element.get('id')
@@ -251,7 +251,7 @@ def __init__(self, element):
251251
self.astOperand2 = None
252252
self.file = element.get('file')
253253
self.linenr = int(element.get('linenr'))
254-
self.col = int(element.get('col'))
254+
self.column = int(element.get('column'))
255255

256256
def setId(self, IdMap):
257257
self.scope = IdMap[self.scopeId]
@@ -868,7 +868,7 @@ def reportError(location, severity, message, addon, errorId, extra=''):
868868
if '--cli' in sys.argv:
869869
msg = { 'file': location.file,
870870
'linenr': location.linenr,
871-
'col': location.col,
871+
'column': location.column,
872872
'severity': severity,
873873
'message': message,
874874
'addon': addon,

addons/misra.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ def misra_5_1(self, data):
746746
tokens = long_vars[name_prefix]
747747
if len(tokens) < 2:
748748
continue
749-
for tok in sorted(tokens, key=lambda t: (t.linenr, t.col))[1:]:
749+
for tok in sorted(tokens, key=lambda t: (t.linenr, t.column))[1:]:
750750
self.reportError(tok, 5, 1)
751751

752752
def misra_5_2(self, data):
@@ -1479,7 +1479,7 @@ def misra_15_7(self, data):
14791479
continue
14801480
if not simpleMatch(scope.bodyStart, '{ if ('):
14811481
continue
1482-
if scope.bodyStart.col > 0:
1482+
if scope.bodyStart.column > 0:
14831483
continue
14841484
tok = scope.bodyStart.next.next.link
14851485
if not simpleMatch(tok, ') {'):

cli/threadexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ unsigned int ThreadExecutor::check()
294294
oss << "Internal error: Child process crashed with signal " << WTERMSIG(stat);
295295

296296
std::list<ErrorLogger::ErrorMessage::FileLocation> locations;
297-
locations.emplace_back(childname, 0);
297+
locations.emplace_back(childname, 0, 0);
298298
const ErrorLogger::ErrorMessage errmsg(locations,
299299
emptyString,
300300
Severity::error,

gui/checkthread.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void CheckThread::parseAddonErrors(QString err, const QString &tool)
347347
/*
348348
msg = { 'file': location.file,
349349
'linenr': location.linenr,
350-
'col': location.col,
350+
'column': location.column,
351351
'severity': severity,
352352
'message': message,
353353
'addon': addon,
@@ -357,14 +357,13 @@ void CheckThread::parseAddonErrors(QString err, const QString &tool)
357357

358358
const std::string &filename = obj["file"].toString().toStdString();
359359
const int lineNumber = obj["linenr"].toInt();
360-
const int column = obj["col"].toInt();
360+
const int column = obj["column"].toInt();
361361
const std::string severity = obj["severity"].toString().toStdString();
362362
const std::string message = obj["message"].toString().toStdString();
363363
const std::string id = (obj["addon"].toString() + "-" + obj["errorId"].toString()).toStdString();
364364

365365
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
366-
callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(filename, lineNumber));
367-
callstack.back().col = column;
366+
callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(filename, lineNumber, column));
368367
ErrorLogger::ErrorMessage errmsg(callstack, filename, Severity::fromString(severity), message, id, false);
369368

370369
if (isSuppressed(errmsg.toSuppressionsErrorMessage()))
@@ -387,9 +386,9 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
387386
if (line.startsWith("Assertion failed:")) {
388387
ErrorItem e;
389388
e.errorPath.append(QErrorPathItem());
390-
e.errorPath.last().file = file0;
391-
e.errorPath.last().line = 1;
392-
e.errorPath.last().col = 1;
389+
e.errorPath.last().file = file0;
390+
e.errorPath.last().line = 1;
391+
e.errorPath.last().column = 1;
393392
e.errorId = tool + "-internal-error";
394393
e.file0 = file0;
395394
e.message = line;
@@ -409,7 +408,7 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
409408
errorItem.errorPath.append(QErrorPathItem());
410409
errorItem.errorPath.last().file = r1.cap(1);
411410
errorItem.errorPath.last().line = r1.cap(2).toInt();
412-
errorItem.errorPath.last().col = r1.cap(3).toInt();
411+
errorItem.errorPath.last().column = r1.cap(3).toInt();
413412
if (r1.cap(4) == "warning")
414413
errorItem.severity = Severity::SeverityType::warning;
415414
else if (r1.cap(4) == "error" || r1.cap(4) == "fatal error")
@@ -461,7 +460,7 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
461460

462461
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
463462
foreach (const QErrorPathItem &path, e.errorPath) {
464-
callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(path.file.toStdString(), path.info.toStdString(), path.line));
463+
callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(path.file.toStdString(), path.info.toStdString(), path.line, path.column));
465464
}
466465
const std::string f0 = file0.toStdString();
467466
const std::string msg = e.message.toStdString();

gui/erroritem.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
QErrorPathItem::QErrorPathItem(const ErrorLogger::ErrorMessage::FileLocation &loc)
2323
: file(QString::fromStdString(loc.getfile(false)))
2424
, line(loc.line)
25-
, col(loc.col)
25+
, column(loc.column)
2626
, info(QString::fromStdString(loc.getinfo()))
2727
{
2828
}
2929

3030
bool operator==(const QErrorPathItem &i1, const QErrorPathItem &i2)
3131
{
32-
return i1.file == i2.file && i1.col == i2.col && i1.line == i2.line && i1.info == i2.info;
32+
return i1.file == i2.file && i1.column == i2.column && i1.line == i2.line && i1.info == i2.info;
3333
}
3434

3535
ErrorItem::ErrorItem()
@@ -40,16 +40,16 @@ ErrorItem::ErrorItem()
4040
}
4141

4242
ErrorItem::ErrorItem(const ErrorLogger::ErrorMessage &errmsg)
43-
: errorId(QString::fromStdString(errmsg._id))
44-
, severity(errmsg._severity)
45-
, inconclusive(errmsg._inconclusive)
43+
: errorId(QString::fromStdString(errmsg.id))
44+
, severity(errmsg.severity)
45+
, inconclusive(errmsg.inconclusive)
4646
, summary(QString::fromStdString(errmsg.shortMessage()))
4747
, message(QString::fromStdString(errmsg.verboseMessage()))
48-
, cwe(errmsg._cwe.id)
48+
, cwe(errmsg.cwe.id)
4949
, symbolNames(QString::fromStdString(errmsg.symbolNames()))
5050
{
51-
for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator loc = errmsg._callStack.begin();
52-
loc != errmsg._callStack.end();
51+
for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator loc = errmsg.callStack.begin();
52+
loc != errmsg.callStack.end();
5353
++loc) {
5454
errorPath << QErrorPathItem(*loc);
5555
}

gui/erroritem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class GuiSeverity {
5151
*/
5252
class QErrorPathItem {
5353
public:
54-
QErrorPathItem() : line(0), col(-1) {}
54+
QErrorPathItem() : line(0), column(-1) {}
5555
explicit QErrorPathItem(const ErrorLogger::ErrorMessage::FileLocation &loc);
5656
QString file;
57-
unsigned int line;
58-
int col;
57+
int line;
58+
int column;
5959
QString info;
6060
};
6161

gui/newsuppressiondialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ NewSuppressionDialog::NewSuppressionDialog(QWidget *parent) :
1414
public:
1515
virtual void reportOut(const std::string &/*outmsg*/) {}
1616
virtual void reportErr(const ErrorLogger::ErrorMessage &msg) {
17-
errorIds << QString::fromStdString(msg._id);
17+
errorIds << QString::fromStdString(msg.id);
1818
}
1919
QStringList errorIds;
2020
};

gui/resultstree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
187187
data["message"] = item.message;
188188
data["file"] = loc.file;
189189
data["line"] = loc.line;
190-
data["col"] = loc.col;
190+
data["column"] = loc.column;
191191
data["id"] = item.errorId;
192192
data["inconclusive"] = item.inconclusive;
193193
data["file0"] = stripPath(item.file0, true);
@@ -219,7 +219,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
219219
child_data["message"] = line.message;
220220
child_data["file"] = e.file;
221221
child_data["line"] = e.line;
222-
child_data["col"] = e.col;
222+
child_data["column"] = e.column;
223223
child_data["id"] = line.errorId;
224224
child_data["inconclusive"] = line.inconclusive;
225225
child_item->setData(QVariant(child_data));

gui/threadresult.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
6161
{
6262
QMutexLocker locker(&mutex);
6363
const ErrorItem item(msg);
64-
if (msg._severity != Severity::debug)
64+
if (msg.severity != Severity::debug)
6565
emit error(item);
6666
else
6767
emit debugError(item);

gui/xmlreportv2.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ static const QString CppcheckElementName = "cppcheck";
3333
static const QString ErrorElementName = "error";
3434
static const QString ErrorsElementName = "errors";
3535
static const QString LocationElementName = "location";
36-
static const QString ColAttribute = "col";
3736
static const QString CWEAttribute = "cwe";
3837
static const QString SinceDateAttribute = "sinceDate";
3938
static const QString TagsAttribute = "tag";
@@ -42,6 +41,7 @@ static const QString IncludedFromFilenameAttribute = "file0";
4241
static const QString InconclusiveAttribute = "inconclusive";
4342
static const QString InfoAttribute = "info";
4443
static const QString LineAttribute = "line";
44+
static const QString ColumnAttribute = "column";
4545
static const QString IdAttribute = "id";
4646
static const QString SeverityAttribute = "severity";
4747
static const QString MsgAttribute = "msg";
@@ -136,8 +136,8 @@ void XmlReportV2::writeError(const ErrorItem &error)
136136
}
137137
mXmlWriter->writeAttribute(FilenameAttribute, XmlReport::quoteMessage(file));
138138
mXmlWriter->writeAttribute(LineAttribute, QString::number(error.errorPath[i].line));
139-
if (error.errorPath[i].col > 0)
140-
mXmlWriter->writeAttribute(ColAttribute, QString::number(error.errorPath[i].col));
139+
if (error.errorPath[i].column > 0)
140+
mXmlWriter->writeAttribute(ColumnAttribute, QString::number(error.errorPath[i].column));
141141
if (error.errorPath.count() > 1)
142142
mXmlWriter->writeAttribute(InfoAttribute, XmlReport::quoteMessage(error.errorPath[i].info));
143143

@@ -235,8 +235,8 @@ ErrorItem XmlReportV2::readError(QXmlStreamReader *reader)
235235
QErrorPathItem loc;
236236
loc.file = XmlReport::unquoteMessage(attribs.value(QString(), FilenameAttribute).toString());
237237
loc.line = attribs.value(QString(), LineAttribute).toString().toUInt();
238-
if (attribs.hasAttribute(QString(), ColAttribute))
239-
loc.col = attribs.value(QString(), ColAttribute).toString().toInt();
238+
if (attribs.hasAttribute(QString(), ColumnAttribute))
239+
loc.column = attribs.value(QString(), ColumnAttribute).toString().toInt();
240240
if (attribs.hasAttribute(QString(), InfoAttribute))
241241
loc.info = XmlReport::unquoteMessage(attribs.value(QString(), InfoAttribute).toString());
242242
item.errorPath.push_front(loc);

0 commit comments

Comments
 (0)