{ "tokens": { "input": 324579, "cache_read": 298557, "cache_write": 6093, "output": 34708 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your src/3rdParty/lru-cache/tests/iterator-test.cpp:133:11: style: Redundant initialization for 'ordered'. The initialized value is overwritten before it is read. [redundantInitialization]\n src/3rdParty/lru-cache/tests/iterator-test.cpp:132:26: note: ordered is initialized\n src/3rdParty/lru-cache/tests/iterator-test.cpp:133:11: note: ordered is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 132 direct-initializes `ordered` with `OrderedIterator ordered(unordered);`. Line 133 then assigns `ordered = OrderedIterator(unordered);` before `ordered` is read. The initialized value is really overwritten unused, so this is a true positive. The PR now covers paren-initialization the same way it already covered `T x = ...;`. The rhs here is a non-trivial variable, so the trivial-init exemption rightly does not apply. In this test the double construction is deliberate (it checks that both forms compile), which makes the finding low-value here. The diagnostic itself is still accurate." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your src/3rdParty/lru-cache/tests/iterator-test.cpp:147:17: style: Redundant initialization for 'const_ordered'. The initialized value is overwritten before it is read. [redundantInitialization]\n src/3rdParty/lru-cache/tests/iterator-test.cpp:146:37: note: const_ordered is initialized\n src/3rdParty/lru-cache/tests/iterator-test.cpp:147:17: note: const_ordered is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 146 direct-initializes `const_ordered` from `std::move(const_unordered)`. Line 147 then assigns it a new `OrderedConstIterator` without reading the first value in between. The initialized value is therefore dead, which is exactly what redundantInitialization reports. Before this PR, Cppcheck already reported the `T x = expr; x = ...;` form; the PR extends that to the `T x(expr);` form. That makes the check consistent, and this hit is technically a true positive. The test may be deliberately exercising both the constructor and the assignment, and the converting constructor might have side effects. Still, the warning itself is accurate (the initialized value is overwritten before it is read). There is no custom-operator inconclusive marking, which suggests Cppcheck saw no user `operator=`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1114:8: style: Redundant initialization for 'Xx'. The initialized value is overwritten before it is read. [redundantInitialization]\n src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1056:19: note: Xx is initialized\n src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1114:8: note: Xx is overwritten" ], "verdict": { "verdict": "regression", "confidence": "medium", "explanation": "Line 1056 is most likely `math_Matrix Xx(0, n-1, 0, 0);`: an OpenCASCADE matrix constructed with its dimensions, which are member variables, so the arguments are not trivial. The new constructor-syntax handling sees `Xx = hhX.AllValues();` at line 1114 and reports the initialization as redundant. However, `math_Matrix::operator=` is `Initialized()`, which copies into the existing storage and checks that the dimensions match. So the constructor arguments are effectively read by the assignment. The class also has no default constructor, so the initialization cannot simply be dropped. Cppcheck flags it only because the OCC headers are missing and it cannot see the custom assignment operator. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1115:8: style: Redundant initialization for 'Xy'. The initialized value is overwritten before it is read. [redundantInitialization]\n src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1057:19: note: Xy is initialized\n src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1115:8: note: Xy is overwritten" ], "verdict": { "verdict": "regression", "confidence": "medium", "explanation": "The note column (1057:19) points at the '(' after `math_Matrix Xy`, so this is almost certainly a constructor call such as `math_Matrix Xy(0, ulDim - 1, 0, 0);`. Those arguments are matrix dimensions, not a value that later gets overwritten. OCCT's math_Matrix::operator= (Initialized) requires the target to already have matching dimensions, so the sized construction is needed before `Xy = hhY.AllValues();`. The PR now treats any constructor-style `(`/`{` declaration of a class-type variable as a redundant initialization. That produces a false positive here; the message's wording about an 'initialized value' is also misleading for constructor arguments." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1116:8: style: Redundant initialization for 'Xz'. The initialized value is overwritten before it is read. [redundantInitialization]\n src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1058:19: note: Xz is initialized\n src/Mod/ReverseEngineering/App/ApproxSurface.cpp:1116:8: note: Xz is overwritten" ], "verdict": { "verdict": "regression", "confidence": "medium", "explanation": "Line 1058 is almost certainly a sized OpenCASCADE matrix declaration such as `math_Matrix Xz(0, ulDim - 1, 0, 0);`, and line 1116 then assigns `Xz = hhZ.AllValues();`. The constructor arguments are not a value that gets thrown away: they set the matrix bounds. `math_Matrix` has no default constructor, and its `operator=` requires matching dimensions. So the initialization cannot simply be removed, and the claim that 'the initialized value is overwritten before it is read' is misleading. The PR now treats any `T x(args)` constructor call as an initialization. Because the class type is unknown here (no type info from external headers), the custom assignment operator is not detected and the warning is not marked inconclusive. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your src/Mod/TechDraw/Gui/QGIFace.cpp:364:17: style: Redundant initialization for 'tilePixmap'. The initialized value is overwritten before it is read. [redundantInitialization]\n src/Mod/TechDraw/Gui/QGIFace.cpp:363:23: note: tilePixmap is initialized\n src/Mod/TechDraw/Gui/QGIFace.cpp:364:17: note: tilePixmap is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 363 constructs `tilePixmap` as `QPixmap tilePixmap(round(wTile), round(hTile))`, which allocates a pixmap of that size. Line 364 then assigns `QPixmap::fromImage(svgImage)` to it before it is ever read. The constructed pixmap is never used, so the initialization is truly redundant and wastes an allocation. The PR now treats constructor-style initialization `(...)` as an initialization. The arguments contain variables, so the init is not considered trivial and the check reports it. This is a new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your src/Mod/TechDraw/Gui/QGIFace.cpp:403:17: style: Redundant initialization for 'fieldPixmap'. The initialized value is overwritten before it is read. [redundantInitialization]\n src/Mod/TechDraw/Gui/QGIFace.cpp:402:24: note: fieldPixmap is initialized\n src/Mod/TechDraw/Gui/QGIFace.cpp:403:17: note: fieldPixmap is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 402 builds `QPixmap fieldPixmap(overlayWidth, overlayHeight)`. This allocates a pixmap of that size, and its contents are never read. Line 403 then assigns `QPixmap::fromImage(tileField)` to `fieldPixmap`, which replaces it completely. So the constructor-initialized value is overwritten before any read, and the allocation is wasted work. The PR extends the redundant-initialization check to constructor-style init `(`/`{`, and this is a genuine true positive: the code could simply be `QPixmap fieldPixmap = QPixmap::fromImage(tileField);`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObject.cpp:114:25: style: Redundant initialization for 'docSubObjsNoSubName'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObject.cpp:102:30: note: docSubObjsNoSubName is initialized\n tests/src/App/DocumentObject.cpp:114:25: note: docSubObjsNoSubName is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The source shown does not match the warning. It appears to be src/App/DocumentObject.cpp, where line 114 is a `break;` inside printInvalidLinks, not the test file. No variable named docSubObjsNoSubName appears in it. The columns suggest a brace initialization like `auto docSubObjsNoSubName {expr};` at line 102, followed by `docSubObjsNoSubName = ...;` at line 114. That is exactly the brace-init pattern the PR now checks. Without the actual test code, I cannot confirm whether the initial value is read in between or has side effects." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObject.cpp:115:27: style: Redundant initialization for 'docSubObjsWithSubName'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObject.cpp:105:32: note: docSubObjsWithSubName is initialized\n tests/src/App/DocumentObject.cpp:115:27: note: docSubObjsWithSubName is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "medium", "explanation": "The excerpt is from src/App/DocumentObject.cpp, but the warning is for tests/src/App/DocumentObject.cpp. In the excerpt, line 105 declares 'invalid_linkobjs', not 'docSubObjsWithSubName'. The PR now treats brace and paren initialization as initialization for redundantInitialization, so this could be a real finding: a variable initialized at line 105 and overwritten at line 115 with no read in between. Without the actual test source, I cannot check whether the initializer has side effects or whether the variable is read in between." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObject.cpp:116:28: style: Redundant initialization for 'docSubObjsWithSubSizes'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObject.cpp:108:33: note: docSubObjsWithSubSizes is initialized\n tests/src/App/DocumentObject.cpp:116:28: note: docSubObjsWithSubSizes is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The excerpt shown is from src/App/DocumentObject.cpp (printInvalidLinks), not tests/src/App/DocumentObject.cpp, so the flagged lines 108 and 116 cannot be checked. The columns suggest something like `auto docSubObjsWithSubSizes {expr};` at line 108 and `docSubObjsWithSubSizes = ...;` at line 116. That is exactly the brace-init form the PR newly handles, and it would be a true positive if the variable is not read in between. Without the actual test source, whether it is read in between cannot be verified." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObject.cpp:117:23: style: Redundant initialization for 'docSubObjsFlatten'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObject.cpp:111:28: note: docSubObjsFlatten is initialized\n tests/src/App/DocumentObject.cpp:117:23: note: docSubObjsFlatten is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The source excerpt is from src/App/DocumentObject.cpp (printInvalidLinks), not from tests/src/App/DocumentObject.cpp. It does not contain 'docSubObjsFlatten' at all. The column positions suggest a brace initialization at line 111 (the new `{`/`(` init path added by the PR) and a plain assignment at line 117. The sibling warnings follow the same pattern of inits at 102\u2013111 and assignments at 114\u2013117. Without the actual test code, I cannot confirm that the initialized value is never read, or that the initializer has no side effects the test depends on." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObject.cpp:73:9: style: Redundant initialization for 'cmd'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObject.cpp:67:14: note: cmd is initialized\n tests/src/App/DocumentObject.cpp:73:9: note: cmd is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "medium", "explanation": "The source shown does not match the warning. It is the constructor of src/App/DocumentObject.cpp: line 73 is blank and line 67 is '{', with no variable 'cmd' anywhere. The real tests/src/App/DocumentObject.cpp (presumably a test where 'cmd' is brace- or paren-initialized and later reassigned) is not shown. So I cannot check whether 'cmd' is read between its initialization and the reassignment, or whether the initializer has side effects." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObject.cpp:85:13: style: Redundant initialization for 'subName'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObject.cpp:57:18: note: subName is initialized\n tests/src/App/DocumentObject.cpp:85:13: note: subName is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The code shown is from src/App/DocumentObject.cpp, not the reported file tests/src/App/DocumentObject.cpp. Line 85 here is the opening brace of a destructor, and no 'subName' variable appears at line 57 or 85. The warning is new because the PR now treats brace/paren initialization (e.g. `std::string subName{...}`) as an initialization site. Without the real test source, I cannot check whether subName is read or passed by reference between line 57 and line 85, so I cannot tell if the warning is correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:165:9: style: Redundant initialization for 'cmd'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:159:14: note: cmd is initialized\n tests/src/App/DocumentObserver.cpp:165:9: note: cmd is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "medium", "explanation": "The excerpt shown is from src/App/DocumentObserver.cpp (the DocumentObjectT::operator= implementation), not from tests/src/App/DocumentObserver.cpp. It contains no variable 'cmd', so neither the initialization at line 159 nor the overwrite at line 165 is visible. The new warning comes from the PR's new handling of brace/paren initialization, and that may well be correct. But I cannot check whether 'cmd' is read between the two lines, or whether its initializer has side effects." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:198:13: style: Redundant initialization for 'subName'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:156:18: note: subName is initialized\n tests/src/App/DocumentObserver.cpp:198:13: note: subName is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "medium", "explanation": "The source shown does not match the warning. Line 198 here is the definition of `DocumentObjectT::getDocument()`, which has no `subName` variable. This looks like `src/App/DocumentObserver.cpp`, not `tests/src/App/DocumentObserver.cpp`. The warning comes from the new handling of brace/paren initialization (`T subName{...}` / `T subName(...)`). Judging it requires seeing whether `subName` is read anywhere between line 156 and the reassignment at line 198. With the actual test code unavailable, I cannot tell if the 42-line gap contains a read, so the warning cannot be verified." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:349:9: style: Redundant initialization for 'cmd'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:343:14: note: cmd is initialized\n tests/src/App/DocumentObserver.cpp:349:9: note: cmd is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "low", "explanation": "The snippet shown is from the library, not from tests/src/App/DocumentObserver.cpp, so the actual lines 343/349 are not visible. The note columns give a strong hint, though. `cmd` initialized at column 14 and `subName` at column 18 both fit `auto cmd {\u2026}` / `auto subName {\u2026}` brace initialization. That suggests a test pattern like `auto cmd {std::string()};` followed by `cmd = \u2026;` a few lines later with no read in between. The PR intentionally extends redundantInitialization to brace and paren init. Cppcheck already reports the equivalent `auto cmd = std::string(); cmd = \u2026;`. Trivial or empty `{}` initializers are still skipped. If the code is as inferred, the initialized value really is overwritten unread, so this is a new true positive. Confidence is low because the real source is not shown." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:399:13: style: Redundant initialization for 'subName'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:340:18: note: subName is initialized\n tests/src/App/DocumentObserver.cpp:399:13: note: subName is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "medium", "explanation": "The excerpt is the wrong file. It shows src/App/DocumentObserver.cpp, where line 399 is `for (;; --sub)` and has no `subName` variable, not the test file tests/src/App/DocumentObserver.cpp. The PR newly treats brace and paren initialization of `subName` at line 340 as an initialization and reports it as overwritten at line 399. Without the real test code it is impossible to check whether `subName` is read in the ~60 lines between. It could be read through a lambda, macro or reference, which would make this a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:444:28: style: Redundant initialization for 'subObjTEmptyNormalized'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:428:33: note: subObjTEmptyNormalized is initialized\n tests/src/App/DocumentObserver.cpp:444:28: note: subObjTEmptyNormalized is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "low", "explanation": "The snippet shown comes from src/App/DocumentObserver.cpp, not from the test file in the warning, so the exact test code is not visible. The reported columns do fit a common test pattern: `auto subObjTEmptyNormalized {\u2026};` at 428:33, then a plain `subObjTEmptyNormalized = \u2026;` at 444:28 with nothing reading it in between. The braced initial value is therefore overwritten unread, which is a true redundantInitialization. Before this PR, Cppcheck already reported the same thing for the `auto x = \u2026;` spelling, and the PR deliberately extends the check to brace and paren initialization. The new warning is likely a correct new true positive, but confidence is low because the actual source lines could not be checked." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:445:36: style: Redundant initialization for 'subObjTWithoutSubObjNormalized'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:430:41: note: subObjTWithoutSubObjNormalized is initialized\n tests/src/App/DocumentObserver.cpp:445:36: note: subObjTWithoutSubObjNormalized is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "low", "explanation": "The excerpt shown is from src/App/DocumentObserver.cpp, not the test file in the warning, so the actual lines are not visible. The column positions fit the usual FreeCAD test pattern. At 430:41 the variable is brace-initialized, e.g. `auto subObjTWithoutSubObjNormalized {...};`. At 445:36 it is plainly reassigned, e.g. `subObjTWithoutSubObjNormalized = ...;`. The PR extends redundantInitialization from `=` initializers to `{}` and `()` initializers. If nothing reads the variable in between (FwdAnalysis checks for reads), the initial value really is dead. That would make this a valid new style finding, consistent with what the check already reported for `auto x = ...; x = ...;`. Confidence is low because the real source lines are not shown." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:446:33: style: Redundant initialization for 'subObjTWithSubObjNormalized'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:432:38: note: subObjTWithSubObjNormalized is initialized\n tests/src/App/DocumentObserver.cpp:446:33: note: subObjTWithSubObjNormalized is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The snippet shown is from src/App/DocumentObserver.cpp, the SubObjectT::normalized() implementation. The warning is in tests/src/App/DocumentObserver.cpp, so the actual initialization (line 432) and reassignment (line 446) cannot be seen. The PR makes the check handle brace and paren initialization, so this is probably a class object that is initialized and later reassigned with something like `x = y.normalized()`. Whether the initial value is really unused depends on code between lines 432 and 446 that is not shown. That code might call a member such as normalize() that reads the object, or the constructor might have side effects. Without that code, I cannot tell whether this is a true or false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:447:32: style: Redundant initialization for 'subObjTWithoutElNormalized'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:434:37: note: subObjTWithoutElNormalized is initialized\n tests/src/App/DocumentObserver.cpp:447:32: note: subObjTWithoutElNormalized is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "medium", "explanation": "The warning is in tests/src/App/DocumentObserver.cpp, but the code shown is from src/App/DocumentObserver.cpp: line 447 there is just the closing brace of SubObjectT::normalized(). So the brace/paren initialization at 434:37 and the later assignment at 447:32 cannot be checked. The column numbers suggest a test that initializes a variable with braces and then reassigns it without reading it. That pattern would be a correct redundantInitialization from the new brace/paren handling. Whether the initializer is non-trivial and really unread cannot be confirmed without the actual source." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:448:32: style: Redundant initialization for 'subObjTNoFlattenNormalized'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:436:37: note: subObjTNoFlattenNormalized is initialized\n tests/src/App/DocumentObserver.cpp:448:32: note: subObjTNoFlattenNormalized is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "medium", "explanation": "The excerpt shown is from src/App/DocumentObserver.cpp (the SubObjectT implementation), not from tests/src/App/DocumentObserver.cpp, which is the file the warning refers to. Line 448 in the excerpt is blank, so the code for the initialization at line 436 and the overwrite at line 448 is not visible. The PR now also checks brace/paren-initialized variables, so this is presumably a `T x{...};` later reassigned. Without the actual test code, it is impossible to tell whether the variable is read in between or whether the initializer matters, so the warning cannot be judged as true or false." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:449:34: style: Redundant initialization for 'subObjTKeepSubNameNormalized'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:438:39: note: subObjTKeepSubNameNormalized is initialized\n tests/src/App/DocumentObserver.cpp:449:34: note: subObjTKeepSubNameNormalized is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The excerpt shown is from src/App/DocumentObserver.cpp (line 449 is the setSubName definition), not from tests/src/App/DocumentObserver.cpp, which is where the warning is reported. So the flagged code is not visible. The column positions suggest a pattern like `auto subObjTKeepSubNameNormalized {X};` at line 438, followed by `subObjTKeepSubNameNormalized = ...normalized(...);` at line 449. That is the new brace-init case the PR adds, and it would likely be a true positive (a wasted copy). Without the actual test source, I cannot confirm whether the variable is read in between or whether the initializer has side effects." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/freecad/freecad_1.1.3+dfsg.orig.tar.xz", "your tests/src/App/DocumentObserver.cpp:452:35: style: Redundant initialization for 'subObjTConvertIndexNormalized'. The initialized value is overwritten before it is read. [redundantInitialization]\n tests/src/App/DocumentObserver.cpp:440:40: note: subObjTConvertIndexNormalized is initialized\n tests/src/App/DocumentObserver.cpp:452:35: note: subObjTConvertIndexNormalized is overwritten" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The snippet comes from src/App/DocumentObserver.cpp, not tests/src/App/DocumentObserver.cpp. Line 452 there is the closing brace of setSubName, and 'subObjTConvertIndexNormalized' does not appear in it. The PR extends redundantInitialization to brace/paren initializations. That suggests the test declares the variable with a non-trivial `{...}` initializer at line 440 and assigns it again at line 452. Without the actual test source, it is impossible to check whether the initial value is really never read, or whether the initializer has meaningful side effects." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/h/htdig/htdig_3.2.0b6.orig.tar.gz", "your htdig-3.2.0b6/libhtdig/libhtdig_htdig.cc:887:19: style: Redundant initialization for 'rewritten_url'. The initialized value is overwritten before it is read. [redundantInitialization]\n htdig-3.2.0b6/libhtdig/libhtdig_htdig.cc:736:25: note: rewritten_url is initialized\n htdig-3.2.0b6/libhtdig/libhtdig_htdig.cc:887:19: note: rewritten_url is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "The PR extends redundantInitialization to direct and brace initialization (`T x(expr)` / `T x{expr}`). Line 736 appears to be such a declaration, e.g. `String rewritten_url(the_URL);`, with a non-trivial initializer. The variable is then unconditionally reassigned at line 887 (`rewritten_url = aUrl.get();`) before any visible read. The forward analysis found no read in between, and the shown code first reads it after line 887, so the initial copy is useless. This is the same diagnostic the old code gave for the equivalent `String rewritten_url = the_URL;` form. It is likely a valid new style finding, though lines 736\u2013886 are not shown, so confidence is medium." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:192:12: style: Redundant initialization for 'vMessage'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:191:20: note: vMessage is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:192:12: note: vMessage is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 191 constructs `QVariant vMessage(Message);` and line 192 immediately assigns `vMessage = psiOptions->getPluginOption(constMessage);`. The value from the constructor is never read, so the initialization is redundant. QVariant construction has no meaningful side effects. The PR now treats direct/brace initialization like `=` initialization, which correctly finds this new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:197:18: style: Redundant initialization for 'vEnableDisable'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:196:26: note: vEnableDisable is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:197:18: note: vEnableDisable is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "At line 196, `QVariant vEnableDisable(EnableDisable);` constructs the variable from `EnableDisable`. Line 197 then assigns it `psiOptions->getPluginOption(...)` before it is ever read. The initial value is genuinely dead, which is the redundant initialization this PR now detects for direct-init `(...)`/`{...}` syntax. Constructing a QVariant from an int has no meaningful side effects, so this is a true positive the old code missed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:209:16: style: Redundant initialization for 'vDisableFor'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:208:24: note: vDisableFor is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:209:16: note: vDisableFor is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 208 constructs `QVariant vDisableFor(DisableFor)`, and line 209 immediately assigns `psiOptions->getPluginOption(constEnableFor)` to it. The initial value is never read. The pull request now treats direct `(...)` initialization like `=` initialization, which exposes this real redundancy. QVariant construction from a QString has no meaningful side effects, so this is a true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:222:22: style: Redundant initialization for 'vActiveTabIsEnable'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:221:30: note: vActiveTabIsEnable is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:222:22: note: vActiveTabIsEnable is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "At line 221, `QVariant vActiveTabIsEnable(ActiveTabIsEnable);` constructs the variant from a member value. Line 222 then overwrites it unconditionally with `psiOptions->getPluginOption(...)` before anything reads it. The initial value is dead, and the QVariant constructor has no side effects that matter here, so this is a valid style finding. The PR adds detection of redundant parenthesized and brace initialization, which is exactly this case: a new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:227:14: style: Redundant initialization for 'vResetTime'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:226:22: note: vResetTime is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:227:14: note: vResetTime is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 226 constructs `QVariant vResetTime(ResetTime)`, and line 227 immediately overwrites it with `psiOptions->getPluginOption(...)`. The value from the constructor is never read, so the initialization is genuinely redundant. Constructing a QVariant from an int has no side effects that matter here. The PR now handles direct-initialization syntax `T x(expr);`, so this true positive is newly found. It matches the intended behavior shown in the PR's test case." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:232:18: style: Redundant initialization for 'vDisableForAcc'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:231:26: note: vDisableForAcc is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:232:18: note: vDisableForAcc is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 231 constructs `QVariant vDisableForAcc(DisableForAcc)`, and line 232 unconditionally assigns the result of `getPluginOption()` to it before it is ever read. The initial value is dead, so the code could simply be `QVariant v = psiOptions->getPluginOption(...)`. Constructing a QVariant from a QString has no observable side effects. The new redundantInitialization warning for direct (parenthesized) initialization is therefore a true positive, consistent with what Cppcheck already reports for `T x = expr; x = ...;`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:242:10: style: Redundant initialization for 'vSAway'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:241:18: note: vSAway is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:242:10: note: vSAway is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 241 constructs `QVariant vSAway(SAway)` and line 242 immediately assigns `vSAway = psiOptions->getPluginOption(constSAway)` without reading it in between. The initial value from `SAway` is never used, so the initialization really is redundant. The fix is to initialize directly from `getPluginOption()`. Before this PR, Cppcheck only checked `=`-style initializations; the PR extends the check to `()`/`{}` direct initialization. That catches this real dead store, so it is a new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:247:9: style: Redundant initialization for 'vSDnd'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:246:17: note: vSDnd is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:247:9: note: vSDnd is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "`QVariant vSDnd(SDnd);` builds the variant from `SDnd`, and the next statement, `vSDnd = psiOptions->getPluginOption(constSDnd);`, replaces it before anything reads it. The initial value is never used, so the redundant initialization is real. The PR now treats direct `()` and `{}` initialization like `= ` initialization, which is its stated intent and matches its test case. Constructing a QVariant from a bool has no meaningful side effects, so the new warning is a true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:262:11: style: Redundant initialization for 'vSInvis'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:261:19: note: vSInvis is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:262:11: note: vSInvis is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 261 constructs `QVariant vSInvis(SInvis)` from a member variable. Line 262 immediately overwrites it with `psiOptions->getPluginOption(...)`, and nothing reads it in between. The initial value is never used, so the warning is a true positive. The PR now covers constructor-style initialization, and this is the case it targets. The value is not trivial, and QVariant's assignment simply replaces the value (it is an inconclusive custom operator at most)." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:267:16: style: Redundant initialization for 'vNotInRoster'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:266:24: note: vNotInRoster is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:267:16: note: vNotInRoster is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 266 constructs `QVariant vNotInRoster(NotInRoster)`, and line 267 assigns `psiOptions->getPluginOption(...)` to it. The initial value is never read before it is overwritten, so the initialization is redundant. The code only works as intended because a null QVariant is returned when the option is missing; it does not fall back to the initial value. The new detection of redundant direct (paren/brace) initialization is a correct true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:339:11: style: Redundant initialization for 'vMessage'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:338:19: note: vMessage is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:339:11: note: vMessage is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`QVariant vMessage(Message);` is followed straight away by `vMessage = psiOptions->getPluginOption(constMessage);`. Nothing reads the value set by the constructor before it is overwritten, so the initialization with `Message` is useless. The PR now handles paren/brace-style initialization, which lets Cppcheck catch this. The new redundantInitialization warning is a true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:347:17: style: Redundant initialization for 'vEnableDisable'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:346:25: note: vEnableDisable is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:347:17: note: vEnableDisable is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 346 constructs `QVariant vEnableDisable(EnableDisable);` and line 347 immediately overwrites it with `psiOptions->getPluginOption(...)`. The value from the constructor is never read, so the initialization really is redundant. The PR now treats paren/brace initialization like `=` initialization, so Cppcheck finds this true positive. QVariant's operator= has no side effects that would matter here. The warning is not marked inconclusive, which suggests Cppcheck found no custom operator= in the analyzed scope. The finding itself is correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:356:15: style: Redundant initialization for 'vDisableFor'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:355:23: note: vDisableFor is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:356:15: note: vDisableFor is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 355 constructs `QVariant vDisableFor(DisableFor)`, and line 356 assigns it from `psiOptions->getPluginOption(constDisableFor)` without reading it first. The initial value is never used, so the initialization really is redundant. The PR now handles direct initialization `T x(expr)` the same way it already handled copy-initialization `T x = expr`. This new warning is a true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:365:15: style: Redundant initialization for 'vDisableFor'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:364:23: note: vDisableFor is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:365:15: note: vDisableFor is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 364 constructs `QVariant vDisableFor(DisableFor);` and line 365 immediately assigns `psiOptions->getPluginOption(constEnableFor)` to it. Nothing reads the initial value in between, so the construction from `DisableFor` is useless work. The PR now handles direct and brace initialization, so it catches this pattern, which the old `=` path missed. QVariant has no meaningful constructor side effects. The warning is a correct new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:374:9: style: Redundant initialization for 'vTimes'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:373:17: note: vTimes is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:374:9: note: vTimes is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`QVariant vTimes(Times);` is immediately followed by `vTimes = psiOptions->getPluginOption(constTimes);`, and nothing reads `vTimes` in between. The value set by the constructor is discarded, so the initialization really is redundant. The new direct-initialization support (the `(`/`{` form) catches this correctly. Constructing a QVariant from an int has no side effects that matter, so this is a new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:390:13: style: Redundant initialization for 'vResetTime'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:389:21: note: vResetTime is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:390:13: note: vResetTime is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 389 constructs `QVariant vResetTime(ResetTime)`, and line 390 immediately assigns `psiOptions->getPluginOption(constResetTime)` to it. The initial value is never read, so the initialization is redundant. The `else` branch uses the member `ResetTime` directly, not `vResetTime`. The PR extends the existing check, which already handled `T x = expr;`, to direct initialization `T x(expr)` and `T x{expr}`. This is a valid new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:398:17: style: Redundant initialization for 'vDisableForAcc'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:397:25: note: vDisableForAcc is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:398:17: note: vDisableForAcc is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 397 constructs `QVariant vDisableForAcc(DisableForAcc)`. Line 398 immediately overwrites it with `psiOptions->getPluginOption(...)`, and the variable is not read in between. So the constructor argument is genuinely dead: it is never observed. This is the direct-initialization case the PR was written to catch, and the warning is a true positive. QVariant construction from a QString member has no relevant side effects, and the code style (initialize, then overwrite) really is redundant. It was likely meant to be a fallback but is not used as one." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:407:11: style: Redundant initialization for 'vSOnline'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:406:19: note: vSOnline is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:407:11: note: vSOnline is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Line 406 constructs `QVariant vSOnline(SOnline)`, and line 407 immediately assigns `psiOptions->getPluginOption(constSOnline)` to it. The constructed value is never read, so the initialization really is redundant. Constructing a QVariant from a bool member has no meaningful side effects. This is the paren-initialization case that the PR deliberately adds to match the existing `=` initialization check, so this is a new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:423:8: style: Redundant initialization for 'vSDnd'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:422:16: note: vSDnd is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:423:8: note: vSDnd is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The new check now covers constructor-style initialization `T x(expr);` and `T x{expr};`, not only `T x = expr;`. At line 422, `QVariant vSDnd(SDnd);` builds a QVariant from the member `SDnd`. Line 423 then unconditionally overwrites it with `psiOptions->getPluginOption(constSDnd)` before it is ever read. Constructing a QVariant from a bool has no side effect that matters here, so the initial value is dead. The code could simply be `QVariant vSDnd = psiOptions->getPluginOption(constSDnd);`. This is a true positive that the PR intentionally enables." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:431:7: style: Redundant initialization for 'vSXa'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:430:15: note: vSXa is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:431:7: note: vSXa is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`QVariant vSXa(SXa);` is immediately followed by `vSXa = psiOptions->getPluginOption(constSXa);`, so the constructor-initialized value is never read. The PR extends the redundant-initialization check to direct `(...)` and `{...}` initialization, and the initializer `SXa` is a non-trivial variable read. Constructing a QVariant from a bool has no meaningful side effects, so this is a correct new true positive (`QVariant vSXa;` or initializing directly from `getPluginOption` would suffice)." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:439:9: style: Redundant initialization for 'vSChat'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:438:17: note: vSChat is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:439:9: note: vSChat is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 438 constructs `QVariant vSChat(SChat)` using direct initialization. Line 439 then unconditionally assigns `psiOptions->getPluginOption(constSChat)` to it, before the initial value is ever read. The initialization is therefore redundant. The PR extends the check to cover `()` and `{}` initialization, and this is a correct new finding. The rhs `SChat` is a variable, so it is not a trivial initializer, and constructing a QVariant from a bool has no meaningful side effects." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:455:15: style: Redundant initialization for 'vNotInRoster'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:454:23: note: vNotInRoster is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:455:15: note: vNotInRoster is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "At line 454, `QVariant vNotInRoster(NotInRoster);` builds the variable from a member value. Line 455 then overwrites it with `psiOptions->getPluginOption(...)` before it is ever read. The value from the direct initialization is therefore never used. Constructing a QVariant from a bool has no side effects that matter. The PR extends redundantInitialization to `()`/`{}` initializers, and this is exactly the case it targets. The new warning is a true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:734:15: style: Redundant initialization for 'vDisableFor'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:733:23: note: vDisableFor is initialized\n plugins-1.5/generic/autoreplyplugin/autoreplyplugin.cpp:734:15: note: vDisableFor is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 733 constructs `QVariant vDisableFor(DisableFor)`, and line 734 immediately assigns `psiOptions->getPluginOption(constDisableFor)` to it. The initial value is never read, so the redundant-initialization warning is a true positive. Main missed it only because it did not handle direct (paren/brace) initialization; the PR adds that case. Constructing a QVariant from a QString has no meaningful side effects, so the initialization really is wasted." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/httpuploadplugin/httpuploadplugin.cpp:167:25: style: Redundant initialization for 'tmpJid'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/httpuploadplugin/httpuploadplugin.cpp:166:17: note: tmpJid is initialized\n plugins-1.5/generic/httpuploadplugin/httpuploadplugin.cpp:167:25: note: tmpJid is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "`QString tmpJid(\"\");` sets a value that is never read. The first use of `tmpJid` is the assignment `tmpJid = accInfo->getJid(account)` inside the while condition, which always runs before any read. The redundant initialization warning is therefore technically correct. This is the case the PR adds: direct and brace initialization are now checked like the `=` form. The equivalent `QString tmpJid = \"\";` was already reported, because a string literal is not treated as a trivial initializer. The finding is low-impact, since an empty-string init is harmless, but it is a valid new true positive and consistent with existing behavior." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/psi-plugins/psi-plugins_1.5.orig.tar.gz", "your plugins-1.5/generic/imageplugin/imageplugin.cpp:224:24: style: Redundant initialization for 'tmpJid'. The initialized value is overwritten before it is read. [redundantInitialization]\n plugins-1.5/generic/imageplugin/imageplugin.cpp:223:16: note: tmpJid is initialized\n plugins-1.5/generic/imageplugin/imageplugin.cpp:224:24: note: tmpJid is overwritten" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "`QString tmpJid(\"\");` is directly initialized. The while condition then assigns `tmpJid = accInfo->getJid(account)` before tmpJid is ever read, so the initial value is never used. The PR extends redundantInitialization from `T x = v;` to direct-initialization forms (`T x(v)` / `T x{v}`). This is a genuine new true positive, consistent with what Cppcheck already reports for `QString tmpJid = \"\";`." } } ], "started": "2026-10-06 19:54:35 UTC", "runner": "server" }