-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathAV Rule 69.ql
More file actions
30 lines (28 loc) · 811 Bytes
/
AV Rule 69.ql
File metadata and controls
30 lines (28 loc) · 811 Bytes
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
/**
* @name AV Rule 69
* @description A member function that does not affect the state of an object will be
* declared const.
* @kind problem
* @id cpp/jsf/av-rule-69
* @problem.severity warning
* @tags maintainability
* external/jsf
*/
import cpp
from MemberFunction mf
where
mf.fromSource() and
mf.hasDefinition() and
not mf instanceof Constructor and
not exists(VariableAccess va |
va.isLValue() and
va.getEnclosingFunction() = mf and
(
va.getTarget() instanceof MemberVariable or
va.getTarget() instanceof GlobalVariable
)
) and
forall(Call c | c.getEnclosingFunction() = mf | c.isPure()) and
not mf.hasSpecifier("const")
select mf,
"AV Rule 69: A member function that does not affect the state of an object will be declared const."