forked from github/codeql-coding-standards
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnusedSplMemberFunction.ql
More file actions
32 lines (30 loc) · 1.22 KB
/
UnusedSplMemberFunction.ql
File metadata and controls
32 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* @id cpp/autosar/unused-spl-member-function
* @name M0-1-10: Every defined function should be called at least once
* @description Uncalled functions complicate the program and can indicate a possible mistake on the
* part of the programmer. This query specifically looks for unused Special Member
* Functions.
* @kind problem
* @precision medium
* @problem.severity warning
* @tags external/autosar/id/m0-1-10
* readability
* maintainability
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/advisory
*/
import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.deadcode.UnusedFunctions
from UnusedFunctions::UnusedSplMemberFunction unusedSplMemFunction, string name
where
not isExcluded(unusedSplMemFunction, DeadCodePackage::unusedFunctionQuery()) and
(
if exists(unusedSplMemFunction.getQualifiedName())
then name = unusedSplMemFunction.getQualifiedName()
else name = unusedSplMemFunction.getName()
) and
not unusedSplMemFunction.isDeleted()
select unusedSplMemFunction,
"Special member function " + name + " is " + unusedSplMemFunction.getDeadCodeType()