forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCallToObsoleteMethod.ql
More file actions
26 lines (23 loc) · 823 Bytes
/
CallToObsoleteMethod.ql
File metadata and controls
26 lines (23 loc) · 823 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
/**
* @name Call to obsolete method
* @description Calls to methods marked as [Obsolete] should be replaced because the method is
* no longer maintained and may be removed in the future.
* @kind problem
* @problem.severity warning
* @precision very-high
* @id cs/call-to-obsolete-method
* @tags quality
* maintainability
* changeability
* external/cwe/cwe-477
*/
import csharp
class ObsoleteAttribute extends Attribute {
ObsoleteAttribute() { this.getType().hasFullyQualifiedName("System", "ObsoleteAttribute") }
}
from MethodCall c, Method m
where
m = c.getTarget() and
m.getAnAttribute() instanceof ObsoleteAttribute and
not c.getEnclosingCallable().(Attributable).getAnAttribute() instanceof ObsoleteAttribute
select c, "Call to obsolete method $@.", m, m.getName()