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
Java: Add diagnostic query for framework coverage #7181
Conversation
| modelCoverage(package, _, _, type, _) and | ||
| packageAndType = package + ";" + type and | ||
| rows = sum(int n | modelCoverage(package, _, _, type, n) | n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sum is wrong. You're adding all the different ints that satisfy modelCoverage(package, _, _, type, n), so if two kinds happen to have the exact same number of models, then those numbers won't be added. You'll need to add string kind in the range. Another minor thing: If you change sum to strictsum, then it'll bind package and type so you can drop the first line.
| modelCoverage(package, _, _, type, _) and | |
| packageAndType = package + ";" + type and | |
| rows = sum(int n | modelCoverage(package, _, _, type, n) | n) | |
| packageAndType = package + ";" + type and | |
| rows = strictsum(int n, string kind | modelCoverage(package, _, kind, type, n) | n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation. The kind thing is tricky, that's hard to see.
Regarding strictsum - do you think it might be worth mentioning that on https://codeql.github.com/docs/ql-language-reference/expressions/ ?
Currently it just says strictconcat, strictcount, and strictsum: These aggregates work like concat, count, and sum respectively, except that they are strict. That is, if there are no possible assignments to the aggregation variables that satisfy the formula, then the entire aggregation fails and evaluates to the empty set (instead of defaulting to 0 or the empty string). This is useful if you’re only interested in results where the aggregation body is non-trivial..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the missing kind in the range has nothing to do with the switch from sum to strictsum. The explanation of strictsum that you linked seems perfectly adequate.
No description provided.
The text was updated successfully, but these errors were encountered: