Closed fjatWbyT closed 1 month ago
Hello @lcartey,
I looked for unit tests analogous to the one updated in #690, in this case for A0-1-1 "useless assignment", in contrast with M0-1-9 "no dead code", but couldn't find any already existing. I run locally the (153) tests in cpp/common/test/rules
after applying the change and all pass. I could find tests for useless assignment in deviations, but I doubt those need updating for this change since there's no new deviation.
Does it make sense to add explicit coverage for A0-1-1?
I wonder if it would be sensible to (a) add a new directory cpp/common/uselessassignment
, (b) update configuration so that the ones in cpp/common/deadcode
are also run against A0-1-1, or (c) something else :)
On the one hand, I think that covering these other isUselessSsaDefinition
predicate and InterestingStackVariable
class (assuming they aren't already) would be an improvement. On the other hand, since they are (at least partially) used by the dead code qll, it might not be worth further updates.
Hi @fjatWbyT! Thanks for the PR.
The test cases for A0-1-1
live here:
https://github.com/github/codeql-coding-standards/tree/main/cpp/autosar/test/rules/A0-1-1
The tests live in a common directory when one query implementation is shared by multiple rules - for example, where an AUTOSAR and CERT C++ rule cover the same issue. A0-1-1
is only required to be reported to AUTOSAR, so the tests live in the AUTOSAR test directory, under the rule ID.
Aaah, it is clear now. Thank you very much for the explanation. I will update the PR with extra coverage for this case in that file.
Description
Addresses false positive like the one in #690 in another AUTOSAR ule.
Change request type
.ql
,.qll
,.qls
or unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨 Reviewer: Confirm that format of shared queries (not the .qll file, the .ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.