Skip to content

Commit 1a733a6

Browse files
geoffw0Copilot
andcommitted
C++: Test complex-condition operator threshold
Exercise alternating logical operations above and at the reporting threshold for cpp/complex-condition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent dea8803 commit 1a733a6

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
void complex_condition_one(bool a, bool b, bool c, bool d, bool e, bool f, bool g, bool h, bool i, bool j,
2+
bool k, bool l) {
3+
if (a && b || c && d || e && f || g && h || i && j || k && l) { // $ Alert
4+
}
5+
}
6+
7+
void complex_condition_two(bool a, bool b, bool c, bool d, bool e, bool f, bool g, bool h, bool i, bool j,
8+
bool k, bool l, bool m) {
9+
if (a || b && c || d && e || f && g || h && i || j && k || l && m) { // $ Alert
10+
}
11+
}
12+
13+
void five_logical_operations_is_not_enough(bool a, bool b, bool c, bool d, bool e, bool f) {
14+
if (a && b || c && d || e && f) {
15+
}
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| ComplexCondition.cpp:3:7:3:62 | ... \|\| ... | Complex condition: too many logical operations in this expression. |
2+
| ComplexCondition.cpp:9:7:9:67 | ... \|\| ... | Complex condition: too many logical operations in this expression. |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: Best Practices/ComplexCondition.ql
2+
postprocess: utils/test/InlineExpectationsTestQuery.ql

0 commit comments

Comments
 (0)