Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nbusser opened this issue Jun 5, 2024 · 1 comment
Open

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

nbusser opened this issue Jun 5, 2024 · 1 comment
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium Standard-AUTOSAR user-report Issue reported by an end user of CodeQL Coding Standards

Comments

@nbusser
Copy link

nbusser commented Jun 5, 2024

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 nbusser added the false positive/false negative An issue related to observed false positives or false negatives. label Jun 5, 2024
@lcartey lcartey added the user-report Issue reported by an end user of CodeQL Coding Standards label Oct 15, 2024
@lcartey lcartey added Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address Impact-Medium labels Oct 18, 2024
@lcartey lcartey moved this from Reported to Triaged in Coding Standards Public Development Board Oct 18, 2024
@lcartey
Copy link
Collaborator

lcartey commented Oct 18, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium Standard-AUTOSAR user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Development

No branches or pull requests

3 participants