C++: Mark FPs that are hard to solve w/o source code

This commit is contained in:
Nora Dimitrijević
2022-09-28 16:20:13 +02:00
parent 0128b1702e
commit 823b0109f0

View File

@@ -88,25 +88,25 @@ int test(int i, int j, int (*foo)(int), int (*bar)(int, int))
// Mixed tabs and spaces (ugly case):
for (i = 0, // GOOD if tab >= 4 spaces else BAD
for (i = 0, // GOOD if tab >= 4 spaces else BAD -- can't exclude w/o source code text :/
j = 0;
i + j < 10;
i++, // GOOD if tab >= 4 spaces else BAD
i++, // GOOD if tab >= 4 spaces else BAD -- can't exclude w/o source code text :/
j++);
if (i)
(void)i, // GOOD if tab >= 4 spaces else BAD
(void)i, // GOOD if tab >= 4 spaces else BAD -- can't exclude w/o source code text :/
(void)j;
// One char difference (common but borderline):
for (i = 0, // GOOD? [FALSE POSITIVE]
for (i = 0, // GOOD? [FALSE POSITIVE] -- can't exclude w/o source code text :/
j = 1;
i + j < 10;
i++, j++);
for (i = 0,
j = 1; i < 10; i += 2, // GOOD? [FALSE POSITIVE]
j = 1; i < 10; i += 2, // GOOD? [FALSE POSITIVE] -- can't exclude w/o source code text :/
j++) {}
// LHS ends on same line RHS begins on:
@@ -119,7 +119,7 @@ int test(int i, int j, int (*foo)(int), int (*bar)(int, int))
if (foo(j))
return i++
, i++ // GOOD(?) [FALSE POSITIVE]
, i++ // GOOD(?) [FALSE POSITIVE] -- can't exclude w/o source code text :/
? 1
: 2;