From e208fc67c1be6e74c9f97f7306d87e4a833829ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Fri, 11 Mar 2022 21:42:46 +0100 Subject: [PATCH] small selfcheck improvements (#3888) * CI-unixish.yml: added missing cppcheck-lib library to GUI selfcheck * CI-unixish.yml: split triage from tools selfcheck since it requires the qt library * replaced Q_NULLPTR with nullptr * fixed passedByValue selfcheck warning --- .github/workflows/CI-unixish.yml | 6 ++++-- tools/triage/mainwindow.cpp | 4 ++-- tools/triage/mainwindow.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index ba2429e4c..259333dd1 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -229,6 +229,8 @@ jobs: ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings cli lib # check gui with qt settings mkdir b2 - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp + ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp # self check test and tools - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings test/*.cpp tools + ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp + # triage + ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage diff --git a/tools/triage/mainwindow.cpp b/tools/triage/mainwindow.cpp index f278a0164..64093b2ef 100644 --- a/tools/triage/mainwindow.cpp +++ b/tools/triage/mainwindow.cpp @@ -47,7 +47,7 @@ MainWindow::MainWindow(QWidget *parent) : srcFiles{"*.cpp", "*.cxx", "*.cc", "*.c++", "*.C", "*.c", "*.cl"} { ui->setupUi(this); - std::srand(static_cast(std::time(Q_NULLPTR))); + std::srand(static_cast(std::time(nullptr))); QDir workFolder(WORK_FOLDER); if (!workFolder.exists()) { workFolder.mkdir(WORK_FOLDER); @@ -308,7 +308,7 @@ void MainWindow::showSrcFile(const QString &fileName, const QString &url, const } } -void MainWindow::fileTreeFilter(QString str) +void MainWindow::fileTreeFilter(const QString &str) { mFSmodel.setNameFilters(QStringList{"*" + str + "*"}); mFSmodel.setNameFilterDisables(false); diff --git a/tools/triage/mainwindow.h b/tools/triage/mainwindow.h index 3b9d9283f..7f9099864 100644 --- a/tools/triage/mainwindow.h +++ b/tools/triage/mainwindow.h @@ -33,7 +33,7 @@ class MainWindow : public QMainWindow { Q_OBJECT public: - explicit MainWindow(QWidget *parent = Q_NULLPTR); + explicit MainWindow(QWidget *parent = nullptr); MainWindow(const MainWindow &) = delete; MainWindow &operator=(const MainWindow &) = delete; ~MainWindow(); @@ -44,7 +44,7 @@ public slots: void filter(QString filter); void showResult(QListWidgetItem *item); void refreshResults(); - void fileTreeFilter(QString str); + void fileTreeFilter(const QString &str); void findInFilesClicked(); void directorytreeDoubleClick(); void searchResultsDoubleClick();