forked from nikhilk/scriptsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptAvoidLiteralScript.cs
More file actions
35 lines (28 loc) · 1.09 KB
/
Copy pathScriptAvoidLiteralScript.cs
File metadata and controls
35 lines (28 loc) · 1.09 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
33
34
35
// ScriptAvoidLiteralScript.cs
// Script#/Tools/FxCop
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System;
using System.Diagnostics;
using Microsoft.FxCop.Sdk;
namespace ScriptSharp.FxCop {
public sealed class ScriptAvoidLiteralScript : BaseIntrospectionRule {
public ScriptAvoidLiteralScript() :
base(typeof(ScriptAvoidLiteralScript).Name,
typeof(ScriptAvoidLiteralScript).Namespace + ".RuleData",
typeof(ScriptAvoidLiteralScript).Assembly) {
}
public override ProblemCollection Check(Member member) {
Visit(member);
return Problems;
}
public override void VisitMethodCall(MethodCall call) {
Method method = ((MemberBinding)call.Callee).BoundMember as Method;
if ((method != null) &&
(method.DeclaringType.FullName == "System.Script") &&
(method.Name.Name == "Literal")) {
Problems.Add(new Problem(GetResolution(), call.SourceContext));
}
}
}
}