codeql-coding-standards icon indicating copy to clipboard operation
codeql-coding-standards copied to clipboard

`A5-16-1`: Ternary operator not used as a sub expression

Open nbusser opened this issue 1 year ago • 1 comments

Affected rules

  • A5-16-1

Description

CodeQL triggers A5-16-1 on a plain ternary expression.

Example

const auto smallestSet = (setA.size() < setB.size() ? setA : setB);

nbusser avatar Jun 05 '24 12:06 nbusser

Thanks for this report! This is because the parentheses in your example are considered as the parent of ternary expression. However, one of the rule examples makes it clear that this case should be excluded.

lcartey avatar Oct 18 '24 08:10 lcartey