Skip to content

Commit 703c3e9

Browse files
committed
Add test case for disapplied queries.
1 parent 61c33be commit 703c3e9

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| a0-1-6.cpp:1:7:1:7 | A | Unused type declaration A is not reported with reason 'The query is disapplied.'. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @id cpp/guideline-recategorizations/disapplied-query
3+
* @name Query based on A0-1-6 to test disapplied category
4+
* @kind problem
5+
* @precision very-high
6+
* @problem.severity warning
7+
* @tags external/autosar/id/a0-1-6
8+
* external/autosar/obligation/advisory
9+
*/
10+
11+
import cpp
12+
import codingstandards.cpp.CodingStandards
13+
import codingstandards.cpp.TypeUses
14+
import codingstandards.cpp.exclusions.cpp.RuleMetadata
15+
16+
from UserType ut, string reason
17+
where
18+
isExcluded(ut, DeadCodePackage::unusedTypeDeclarationsQuery(), reason) and
19+
exists(ut.getFile()) and
20+
not ut instanceof TemplateParameter and
21+
not ut instanceof ProxyClass and
22+
not exists(getATypeUse(ut)) and
23+
not ut.isFromUninstantiatedTemplate(_)
24+
select ut,
25+
"Unused type declaration " + ut.getName() + " is not reported with reason '" + reason + "'."
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class A {}; // Unused type declaration

0 commit comments

Comments
 (0)