@@ -44,6 +44,26 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
44
44
{
45
45
foreach ( StringConstantExpressionAst expressionAst in expressionAsts )
46
46
{
47
+ //Check if XPath is used. If XPath is used, then we don't throw warnings.
48
+ Ast parentAst = expressionAst . Parent ;
49
+ if ( parentAst is InvokeMemberExpressionAst )
50
+ {
51
+ InvokeMemberExpressionAst invocation = parentAst as InvokeMemberExpressionAst ;
52
+ if ( invocation != null )
53
+ {
54
+ if ( String . Equals ( invocation . Member . ToString ( ) , "SelectSingleNode" , StringComparison . OrdinalIgnoreCase ) ||
55
+ String . Equals ( invocation . Member . ToString ( ) , "SelectNodes" , StringComparison . OrdinalIgnoreCase ) ||
56
+ String . Equals ( invocation . Member . ToString ( ) , "Select" , StringComparison . OrdinalIgnoreCase ) ||
57
+ String . Equals ( invocation . Member . ToString ( ) , "Evaluate" , StringComparison . OrdinalIgnoreCase ) ||
58
+ String . Equals ( invocation . Member . ToString ( ) , "Matches" , StringComparison . OrdinalIgnoreCase ) )
59
+ {
60
+ continue ;
61
+ }
62
+
63
+ }
64
+ }
65
+
66
+
47
67
bool isPathValid = false ;
48
68
bool isInternalURL = false ;
49
69
//make sure there is no path
@@ -128,7 +148,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
128
148
new DiagnosticRecord (
129
149
String . Format ( CultureInfo . CurrentCulture , Strings . AvoidUsingInternalURLsError ,
130
150
expressionAst . Value ) , expressionAst . Extent ,
131
- GetName ( ) , DiagnosticSeverity . Warning , fileName ) ;
151
+ GetName ( ) , DiagnosticSeverity . Information , fileName ) ;
132
152
133
153
}
134
154
}
@@ -177,7 +197,7 @@ public SourceType GetSourceType()
177
197
/// <returns></returns>
178
198
public RuleSeverity GetSeverity ( )
179
199
{
180
- return RuleSeverity . Warning ;
200
+ return RuleSeverity . Information ;
181
201
}
182
202
183
203
/// <summary>
0 commit comments