01/23/2025 15:31 Dara Navaei sources/canbus/MessageAcknowModel.h:58:9: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning '_sequence' a value by passing the value to the constructor in the initialization list. [useInitializationList] _sequence = vSequence ; ^ sources/canbus/MessageAcknowModel.h:59:9: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning '_frameList' a value by passing the value to the constructor in the initialization list. [useInitializationList] _frameList = vFrameList ; ^ sources/storage/FileHandler.h:109:14: style: Condition '!createFolder' is always false [knownConditionTrueFalse] if ( ! createFolder ) { if ( ! dstDir.exists() ) { err = eDstFolderNotExist ; goto lErr; }} ^ sources/storage/FileHandler.h:101:35: note: Assignment 'createFolder=true', assigned value is 1 bool createFolder = true; ^ sources/storage/FileHandler.h:109:14: note: Condition '!createFolder' is always false if ( ! createFolder ) { if ( ! dstDir.exists() ) { err = eDstFolderNotExist ; goto lErr; }} ^ sources/storage/FileHandler.h:98:17: style: Local variable 'totalSize' shadows outer function [shadowFunction] qint64 totalSize = 0; ^ sources/storage/FileHandler.h:76:21: note: Shadowed declaration static quint64 totalSize(const QFileInfoList &vFileInfoList); ^ sources/storage/FileHandler.h:98:17: note: Shadow variable qint64 totalSize = 0; ^ sources/storage/FileHandler.h:93:33: style: Variable 'err' is assigned a value that is never used. [unreadVariable] FileCopyError_Enums err = eOK; ^ main.cpp:500:28: style: Variable 'scriptName' is assigned a value that is never used. [unreadVariable] QString scriptName = Storage::Device_Lockdown; ^ sources/MainTimer.cpp:78:16: style: The scope of the variable 'oH' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0;' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0;' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static int oH,oM,oS; int cH,cM,cS; ^ sources/MainTimer.cpp:78:19: style: The scope of the variable 'oM' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0;' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0;' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static int oH,oM,oS; int cH,cM,cS; ^ sources/MainTimer.cpp:78:22: style: The scope of the variable 'oS' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0;' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0;' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static int oH,oM,oS; int cH,cM,cS; ^ sources/StateController.cpp:10:18: warning: Member variable 'StateController::_isBroadcastListReady' is not initialized in the constructor. [uninitMemberVarPrivate] StateController::StateController(QObject *parent) : QObject(parent) {} ^ sources/StateController.cpp:10:18: warning: Member variable 'StateController::_isSendListReady' is not initialized in the constructor. [uninitMemberVarPrivate] StateController::StateController(QObject *parent) : QObject(parent) {} ^ sources/StateController.cpp:10:18: warning: Member variable 'StateController::_treatmentVars' is not initialized in the constructor. [uninitMemberVarPrivate] StateController::StateController(QObject *parent) : QObject(parent) {} ^ sources/StateController.cpp:10:18: warning: Member variable 'StateController::_treatmentParams' is not initialized in the constructor. [uninitMemberVarPrivate] StateController::StateController(QObject *parent) : QObject(parent) {} ^ sources/StateController.cpp:10:18: warning: Member variable 'StateController::_hasUserConfirmedToProceed' is not initialized in the constructor. [uninitMemberVarPrivate] StateController::StateController(QObject *parent) : QObject(parent) {} ^ sources/canbus/MessageDispatcher.cpp:254:9: style: Condition 'mNeedsAcknow' is always false [knownConditionTrueFalse] if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:253:25: note: Assignment 'mNeedsAcknow=false', assigned value is 0 bool mNeedsAcknow = false; //needsAcknow(vCanId); ^ sources/canbus/MessageDispatcher.cpp:254:9: note: Condition 'mNeedsAcknow' is always false if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:266:9: style: Condition 'mNeedsAcknow' is always false [knownConditionTrueFalse] if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:253:25: note: Assignment 'mNeedsAcknow=false', assigned value is 0 bool mNeedsAcknow = false; //needsAcknow(vCanId); ^ sources/canbus/MessageDispatcher.cpp:266:9: note: Condition 'mNeedsAcknow' is always false if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:308:9: style: Condition 'mNeedsAcknow' is always false [knownConditionTrueFalse] if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:307:25: note: Assignment 'mNeedsAcknow=false', assigned value is 0 bool mNeedsAcknow = false; //needsAcknow(vCanId); ^ sources/canbus/MessageDispatcher.cpp:308:9: note: Condition 'mNeedsAcknow' is always false if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:326:9: style: Condition 'mNeedsAcknow' is always false [knownConditionTrueFalse] if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:307:25: note: Assignment 'mNeedsAcknow=false', assigned value is 0 bool mNeedsAcknow = false; //needsAcknow(vCanId); ^ sources/canbus/MessageDispatcher.cpp:326:9: note: Condition 'mNeedsAcknow' is always false if (mNeedsAcknow) { ^ sources/canbus/MessageDispatcher.cpp:395:19: style: The scope of the variable 'mActionId' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0;' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0;' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] int mActionId = 0; ^ sources/model/settings/MSettings.cpp:45:15: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] mKeys += keyValue.key(); ^ sources/model/settings/MSettings.cpp:74:17: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] mValues += keyValue.val(); ^ sources/model/settings/MSettings.cpp:91:0: style: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm] if ( vKey == keyValue.key() ) return keyValue.val(); ^ sources/storage/Logger.cpp:222:9: style: Condition 'vUseTempPath' is always false [knownConditionTrueFalse] if (vUseTempPath) { ^ sources/storage/Logger.cpp:219:20: note: Assignment 'vUseTempPath=false', assigned value is 0 vUseTempPath = false; ^ sources/storage/Logger.cpp:222:9: note: Condition 'vUseTempPath' is always false if (vUseTempPath) { ^ sources/storage/Logger.cpp:242:10: style: Condition 'ok' is always true [knownConditionTrueFalse] if ( ok && ! setLogPath(LogType::eLogAppED) ) ok = false; ^ sources/storage/Logger.cpp:241:15: note: Assignment 'ok=true', assigned value is 1 bool ok = true; ^ sources/storage/Logger.cpp:242:10: note: Condition 'ok' is always true if ( ok && ! setLogPath(LogType::eLogAppED) ) ok = false; ^ sources/storage/Logger.cpp:180:17: style: The scope of the variable 'notified' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced: void f(int x) { int i = 0; if (x) { // it's safe to move 'int i = 0;' here for (int n = 0; n < 10; ++n) { // it is possible but not safe to move 'int i = 0;' here do_something(&i); } } } When you see this message it is always safe to reduce the variable scope 1 level. [variableScope] static bool notified = false; ^ sources/storage/Settings.cpp:90:9: style: Redundant initialization for 'err'. The initialized value is overwritten before it is read. [redundantInitialization] err = readCategory(eConfigurationsLocale); ^ sources/storage/Settings.cpp:89:13: note: err is initialized int err = Settings_Error::eError_None; ^ sources/storage/Settings.cpp:90:9: note: err is overwritten err = readCategory(eConfigurationsLocale); ^ sources/utility/format.cpp:98:19: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm] mData += fromVariant(item); ^ sources/utility/qrcodegen.cpp:581:56: style: Suspicious expression. Boolean result is used in bitwise operation. The operator '!' and the comparison operators have higher precedence than bitwise operators. It is recommended that the expression is clarified with parentheses. [clarifyCondition] modules.at(y).at(x) = modules.at(y).at(x) ^ (invert & !isFunction.at(y).at(x)); ^ sources/utility/qrcodegen.cpp:651:5: style: Consider using std::count_if algorithm instead of a raw loop. [useStlAlgorithm] dark++; ^ sources/storage/StorageGlobals.cpp:155:0: style: The function 'Scripts_Path_Name' is never used. [unusedFunction] ^ sources/storage/FileHandler.cpp:124:0: style: The function 'backupFile' is never used. [unusedFunction] ^ sources/model/settings/MSettings.cpp:113:0: style: The function 'categorys' is never used. [unusedFunction] ^ sources/storage/Logger.cpp:405:0: style: The function 'concurrentExportIsOk' is never used. [unusedFunction] ^ sources/storage/Settings.cpp:222:0: style: The function 'configurationsMove' is never used. [unusedFunction] ^ sources/utility/encryption.cpp:154:0: style: The function 'configurationsPassword' is never used. [unusedFunction] ^ sources/utility/encryption.cpp:42:0: style: The function 'cryptClose' is never used. [unusedFunction] ^ sources/utility/encryption.cpp:36:0: style: The function 'cryptFormat' is never used. [unusedFunction] ^ sources/utility/encryption.cpp:30:0: style: The function 'cryptOpen' is never used. [unusedFunction] ^ sources/model/settings/MSettings.cpp:155:0: style: The function 'datetimeFormat' is never used. [unusedFunction] ^ sources/utility/qrcodegen.cpp:247:0: style: The function 'encodeText' is never used. [unusedFunction] ^ sources/utility/types.cpp:28:0: style: The function 'floatCompare' is never used. [unusedFunction] ^ sources/utility/format.cpp:204:0: style: The function 'fromEpoch' is never used. [unusedFunction] ^ sources/utility/format.cpp:216:0: style: The function 'fromVariantList' is never used. [unusedFunction] ^ sources/utility/types.cpp:44:0: style: The function 'getBits' is never used. [unusedFunction] ^ sources/utility/qrcodegen.cpp:372:0: style: The function 'getErrorCorrectionLevel' is never used. [unusedFunction] ^ sources/utility/qrcodegen.cpp:377:0: style: The function 'getMask' is never used. [unusedFunction] ^ sources/utility/qrcodegen.cpp:362:0: style: The function 'getVersion' is never used. [unusedFunction] ^ sources/utility/encryption.cpp:127:0: style: The function 'isDefaultServicePassword' is never used. [unusedFunction] ^ sources/storage/FileHandler.cpp:261:0: style: The function 'isMounted' is never used. [unusedFunction] ^ sources/storage/Settings.cpp:256:0: style: The function 'loadTranslation' is never used. [unusedFunction] ^ main.cpp:494:0: style: The function 'lockdown' is never used. [unusedFunction] ^ sources/canbus/MessageInterpreter.cpp:149:0: style: The function 'logInvalidLength' is never used. [unusedFunction] ^ sources/utility/qrcodegen.cpp:143:0: style: The function 'makeEci' is never used. [unusedFunction] ^ sources/utility/encryption.cpp:48:0: style: The function 'mkfsExt4' is never used. [unusedFunction] ^ sources/storage/FileHandler.cpp:162:0: style: The function 'moveFolder' is never used. [unusedFunction] ^ sources/ApplicationController.cpp:182:0: style: The function 'onActionReceive' is never used. [unusedFunction] ^ sources/storage/Logger.cpp:254:0: style: The function 'onCryptSetupMount' is never used. [unusedFunction] ^ sources/storage/Logger.cpp:418:0: style: The function 'onExportLogs' is never used. [unusedFunction] ^ sources/ApplicationController.cpp:423:0: style: The function 'onQuitApplication' is never used. [unusedFunction] ^ sources/storage/Logger.cpp:540:0: style: The function 'onSDCardSpaceChange' is never used. [unusedFunction] ^ sources/storage/Logger.cpp:518:0: style: The function 'onSDCardStateChange' is never used. [unusedFunction] ^ sources/storage/Logger.cpp:579:0: style: The function 'onSettingsPartitionSpaceChange' is never used. [unusedFunction] ^ sources/storage/Logger.cpp:562:0: style: The function 'onSettingsPartitionStateChange' is never used. [unusedFunction] ^ sources/storage/Settings.cpp:87:0: style: The function 'readLocale' is never used. [unusedFunction] ^ sources/storage/FileHandler.cpp:203:0: style: The function 'removeFiles' is never used. [unusedFunction] ^ sources/storage/Settings.cpp:177:0: style: The function 'save' is never used. [unusedFunction] ^ sources/storage/FileHandler.cpp:466:0: style: The function 'sha256sum' is never used. [unusedFunction] ^ sources/model/settings/MSettings.cpp:146:0: style: The function 'systemLanguage' is never used. [unusedFunction] ^ sources/MainTimer.cpp:137:0: style: The function 'timerEvent' is never used. [unusedFunction] ^ sources/storage/FileHandler.cpp:295:0: style: The function 'tmpUsable' is never used. [unusedFunction] ^ sources/utility/format.cpp:181:0: style: The function 'toStringList' is never used. [unusedFunction] ^ sources/utility/encryption.cpp:54:0: style: The function 'varSalt' is never used. [unusedFunction] ^ nofile:0:0: information: Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config. [missingInclude]