Skip to content

Commit 3cb0a31

Browse files
authored
Fixed #12316 - partially revert "Fix two types of Clazy warnings (#5807)" (#5902)
This partially reverts commit 4a9b921
1 parent b959c11 commit 3cb0a31

11 files changed

Lines changed: 67 additions & 66 deletions

gui/codeeditor.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,15 @@ void CodeEditor::lineNumberAreaPaintEvent(const QPaintEvent *event)
448448
QString CodeEditor::generateStyleString()
449449
{
450450
QString bgcolor = QString("background:rgb(%1,%2,%3);")
451-
.arg(mWidgetStyle->widgetBGColor.red(),
452-
mWidgetStyle->widgetBGColor.green(),
453-
mWidgetStyle->widgetBGColor.blue());
451+
.arg(mWidgetStyle->widgetBGColor.red())
452+
.arg(mWidgetStyle->widgetBGColor.green())
453+
.arg(mWidgetStyle->widgetBGColor.blue());
454454
QString fgcolor = QString("color:rgb(%1,%2,%3);")
455-
.arg(mWidgetStyle->widgetFGColor.red(),
456-
mWidgetStyle->widgetFGColor.green(),
457-
mWidgetStyle->widgetFGColor.blue());
455+
.arg(mWidgetStyle->widgetFGColor.red())
456+
.arg(mWidgetStyle->widgetFGColor.green())
457+
.arg(mWidgetStyle->widgetFGColor.blue());
458458
QString style = QString("%1 %2")
459-
.arg(bgcolor, fgcolor);
459+
.arg(bgcolor)
460+
.arg(fgcolor);
460461
return style;
461462
}

gui/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ QString toFilterString(const QMap<QString,QString>& filters, bool addAllSupporte
6666
// name patterns are our values. The generated filter string list will
6767
// thus be sorted alphabetically over the descriptions.
6868
for (const auto& k: filters.keys()) {
69-
entries << QString("%1 (%2)").arg(k, filters.value(k));
69+
entries << QString("%1 (%2)").arg(k).arg(filters.value(k));
7070
}
7171

7272
return entries.join(";;");

gui/compliancereportdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void ComplianceReportDialog::save()
166166
} catch (InternalError &e) {
167167
QMessageBox msg(QMessageBox::Critical,
168168
tr("Save compliance report"),
169-
tr("Failed to import '%1' (%2), can not show files in compliance report").arg(prjfile, QString::fromStdString(e.errorMessage)),
169+
tr("Failed to import '%1' (%2), can not show files in compliance report").arg(prjfile).arg(QString::fromStdString(e.errorMessage)),
170170
QMessageBox::Ok,
171171
this);
172172
msg.exec();

gui/cppchecklibrarydata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ static std::string mandatoryAttibuteMissing(const QXmlStreamReader &xmlReader, c
4646
{
4747
throw std::runtime_error(QObject::tr("line %1: Mandatory attribute '%2' missing in '%3'")
4848
.arg(xmlReader.lineNumber())
49-
.arg(attributeName, xmlReader.name().toString())
50-
.toStdString());
49+
.arg(attributeName)
50+
.arg(xmlReader.name().toString()).toStdString());
5151
}
5252

5353
static CppcheckLibraryData::Container loadContainer(QXmlStreamReader &xmlReader)

gui/csvreport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void CsvReport::writeError(const ErrorItem &error)
6262
*/
6363

6464
const QString file = QDir::toNativeSeparators(error.errorPath.back().file);
65-
QString line = QString("%1,%2,").arg(file, error.errorPath.back().line);
66-
line += QString("%1,%2,%3").arg(GuiSeverity::toString(error.severity), error.errorId, error.summary);
65+
QString line = QString("%1,%2,").arg(file).arg(error.errorPath.back().line);
66+
line += QString("%1,%2,%3").arg(GuiSeverity::toString(error.severity)).arg(error.errorId).arg(error.summary);
6767
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
6868
mTxtWriter << line << Qt::endl;
6969
#else

gui/librarydialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void LibraryDialog::openCfg()
121121
if (!errmsg.isNull()) {
122122
QMessageBox msg(QMessageBox::Critical,
123123
tr("Cppcheck"),
124-
tr("Failed to load %1. %2.").arg(selectedFile, errmsg),
124+
tr("Failed to load %1. %2.").arg(selectedFile).arg(errmsg),
125125
QMessageBox::Ok,
126126
this);
127127
msg.exec();

gui/mainwindow.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ bool MainWindow::tryLoadLibrary(Library *library, const QString& filename)
861861
const Library::Error error = loadLibrary(library, filename);
862862
if (error.errorcode != Library::ErrorCode::OK) {
863863
if (error.errorcode == Library::ErrorCode::UNKNOWN_ELEMENT) {
864-
QMessageBox::information(this, tr("Information"), tr("The library '%1' contains unknown elements:\n%2").arg(filename, error.reason.c_str()));
864+
QMessageBox::information(this, tr("Information"), tr("The library '%1' contains unknown elements:\n%2").arg(filename).arg(error.reason.c_str()));
865865
return true;
866866
}
867867

@@ -899,7 +899,7 @@ bool MainWindow::tryLoadLibrary(Library *library, const QString& filename)
899899
}
900900
if (!error.reason.empty())
901901
errmsg += " '" + QString::fromStdString(error.reason) + "'";
902-
QMessageBox::information(this, tr("Information"), tr("Failed to load the selected library '%1'.\n%2").arg(filename, errmsg));
902+
QMessageBox::information(this, tr("Information"), tr("Failed to load the selected library '%1'.\n%2").arg(filename).arg(errmsg));
903903
return false;
904904
}
905905
return true;
@@ -958,7 +958,7 @@ Settings MainWindow::getCppcheckSettings()
958958
{
959959
const QString cfgErr = QString::fromStdString(result.loadCppcheckCfg());
960960
if (!cfgErr.isEmpty())
961-
QMessageBox::critical(this, tr("Error"), tr("Failed to load %1 - %2").arg("cppcheck.cfg", cfgErr));
961+
QMessageBox::critical(this, tr("Error"), tr("Failed to load %1 - %2").arg("cppcheck.cfg").arg(cfgErr));
962962

963963
const auto cfgAddons = result.addons;
964964
result.addons.clear();
@@ -1787,7 +1787,7 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const bool check
17871787
if (!errorMessage.isEmpty()) {
17881788
QMessageBox msg(QMessageBox::Critical,
17891789
tr("Cppcheck"),
1790-
tr("Failed to import '%1': %2\n\nAnalysis is stopped.").arg(prjfile, errorMessage),
1790+
tr("Failed to import '%1': %2\n\nAnalysis is stopped.").arg(prjfile).arg(errorMessage),
17911791
QMessageBox::Ok,
17921792
this);
17931793
msg.exec();
@@ -1796,7 +1796,7 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const bool check
17961796
} catch (InternalError &e) {
17971797
QMessageBox msg(QMessageBox::Critical,
17981798
tr("Cppcheck"),
1799-
tr("Failed to import '%1' (%2), analysis is stopped").arg(prjfile, QString::fromStdString(e.errorMessage)),
1799+
tr("Failed to import '%1' (%2), analysis is stopped").arg(prjfile).arg(QString::fromStdString(e.errorMessage)),
18001800
QMessageBox::Ok,
18011801
this);
18021802
msg.exec();
@@ -2100,7 +2100,7 @@ void MainWindow::replyFinished(QNetworkReply *reply) {
21002100
}
21012101
mUI->mButtonHideInformation->setVisible(true);
21022102
mUI->mLabelInformation->setVisible(true);
2103-
mUI->mLabelInformation->setText(tr("New version available: %1. %2").arg(str.trimmed(), install));
2103+
mUI->mLabelInformation->setText(tr("New version available: %1. %2").arg(str.trimmed()).arg(install));
21042104
}
21052105
}
21062106
}

gui/printablereport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void PrintableReport::writeError(const ErrorItem &error)
4646
{
4747
const QString file = QDir::toNativeSeparators(error.errorPath.back().file);
4848
QString line = QString("%1,%2,").arg(file).arg(error.errorPath.back().line);
49-
line += QString("%1,%2").arg(GuiSeverity::toString(error.severity), error.summary);
49+
line += QString("%1,%2").arg(GuiSeverity::toString(error.severity)).arg(error.summary);
5050

5151
mFormattedReport += line;
5252
mFormattedReport += "\n";

gui/resultstree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ void ResultsTree::startApplication(const QStandardItem *target, int application)
816816
}
817817
#endif // Q_OS_WIN
818818

819-
const QString cmdLine = QString("%1 %2").arg(program, params);
819+
const QString cmdLine = QString("%1 %2").arg(program).arg(params);
820820

821821
// this is reported as deprecated in Qt 5.15.2 but no longer in Qt 6
822822
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))

gui/resultsview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void ResultsView::updateDetails(const QModelIndex &index)
463463

464464
const QString file0 = data["file0"].toString();
465465
if (!file0.isEmpty() && Path::isHeader2(data["file"].toString().toStdString()))
466-
formattedMsg += QString("\n\n%1: %2").arg(tr("First included by"), QDir::toNativeSeparators(file0));
466+
formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0));
467467

468468
if (data["cwe"].toInt() > 0)
469469
formattedMsg.prepend("CWE: " + QString::number(data["cwe"].toInt()) + "\n");

0 commit comments

Comments
 (0)