@@ -95,6 +95,76 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
95
95
return diagnosticRecords . ToArray ( ) ; // force evaluation here
96
96
}
97
97
98
+ /// <summary>
99
+ /// Retrieves the common name of this rule.
100
+ /// </summary>
101
+ public override string GetCommonName ( )
102
+ {
103
+ return string . Format ( CultureInfo . CurrentCulture , Strings . UseConsistentWhitespaceCommonName ) ;
104
+ }
105
+
106
+ /// <summary>
107
+ /// Retrieves the description of this rule.
108
+ /// </summary>
109
+ public override string GetDescription ( )
110
+ {
111
+ return string . Format ( CultureInfo . CurrentCulture , Strings . UseConsistentWhitespaceDescription ) ;
112
+ }
113
+
114
+ /// <summary>
115
+ /// Retrieves the name of this rule.
116
+ /// </summary>
117
+ public override string GetName ( )
118
+ {
119
+ return string . Format (
120
+ CultureInfo . CurrentCulture ,
121
+ Strings . NameSpaceFormat ,
122
+ GetSourceName ( ) ,
123
+ Strings . UseConsistentWhitespaceName ) ;
124
+ }
125
+
126
+ /// <summary>
127
+ /// Retrieves the severity of the rule: error, warning or information.
128
+ /// </summary>
129
+ public override RuleSeverity GetSeverity ( )
130
+ {
131
+ return RuleSeverity . Warning ;
132
+ }
133
+
134
+ /// <summary>
135
+ /// Gets the severity of the returned diagnostic record: error, warning, or information.
136
+ /// </summary>
137
+ /// <returns></returns>
138
+ public DiagnosticSeverity GetDiagnosticSeverity ( )
139
+ {
140
+ return DiagnosticSeverity . Warning ;
141
+ }
142
+
143
+ /// <summary>
144
+ /// Retrieves the name of the module/assembly the rule is from.
145
+ /// </summary>
146
+ public override string GetSourceName ( )
147
+ {
148
+ return string . Format ( CultureInfo . CurrentCulture , Strings . SourceName ) ;
149
+ }
150
+
151
+ /// <summary>
152
+ /// Retrieves the type of the rule, Builtin, Managed or Module.
153
+ /// </summary>
154
+ public override SourceType GetSourceType ( )
155
+ {
156
+ return SourceType . Builtin ;
157
+ }
158
+
159
+ private bool IsOperator ( Token token )
160
+ {
161
+ return TokenTraits . HasTrait ( token . Kind , TokenFlags . AssignmentOperator )
162
+ || TokenTraits . HasTrait ( token . Kind , TokenFlags . BinaryPrecedenceAdd )
163
+ || TokenTraits . HasTrait ( token . Kind , TokenFlags . BinaryPrecedenceMultiply )
164
+ || token . Kind == TokenKind . AndAnd
165
+ || token . Kind == TokenKind . OrOr ;
166
+ }
167
+
98
168
private string GetError ( ErrorKind kind )
99
169
{
100
170
switch ( kind )
@@ -302,79 +372,11 @@ private List<CorrectionExtent> GetCorrections(
302
372
} ;
303
373
}
304
374
305
- private bool IsOperator ( Token token )
306
- {
307
- return TokenTraits . HasTrait ( token . Kind , TokenFlags . AssignmentOperator )
308
- || TokenTraits . HasTrait ( token . Kind , TokenFlags . BinaryPrecedenceAdd )
309
- || TokenTraits . HasTrait ( token . Kind , TokenFlags . BinaryPrecedenceMultiply )
310
- || token . Kind == TokenKind . AndAnd
311
- || token . Kind == TokenKind . OrOr ;
312
- }
313
375
314
376
private bool IsPreviousTokenOnSameLine ( LinkedListNode < Token > lparen )
315
377
{
316
378
return lparen . Previous . Value . Extent . EndLineNumber == lparen . Value . Extent . StartLineNumber ;
317
379
}
318
380
319
- /// <summary>
320
- /// Retrieves the common name of this rule.
321
- /// </summary>
322
- public override string GetCommonName ( )
323
- {
324
- return string . Format ( CultureInfo . CurrentCulture , Strings . UseConsistentWhitespaceCommonName ) ;
325
- }
326
-
327
- /// <summary>
328
- /// Retrieves the description of this rule.
329
- /// </summary>
330
- public override string GetDescription ( )
331
- {
332
- return string . Format ( CultureInfo . CurrentCulture , Strings . UseConsistentWhitespaceDescription ) ;
333
- }
334
-
335
- /// <summary>
336
- /// Retrieves the name of this rule.
337
- /// </summary>
338
- public override string GetName ( )
339
- {
340
- return string . Format (
341
- CultureInfo . CurrentCulture ,
342
- Strings . NameSpaceFormat ,
343
- GetSourceName ( ) ,
344
- Strings . UseConsistentWhitespaceName ) ;
345
- }
346
-
347
- /// <summary>
348
- /// Retrieves the severity of the rule: error, warning or information.
349
- /// </summary>
350
- public override RuleSeverity GetSeverity ( )
351
- {
352
- return RuleSeverity . Warning ;
353
- }
354
-
355
- /// <summary>
356
- /// Gets the severity of the returned diagnostic record: error, warning, or information.
357
- /// </summary>
358
- /// <returns></returns>
359
- public DiagnosticSeverity GetDiagnosticSeverity ( )
360
- {
361
- return DiagnosticSeverity . Warning ;
362
- }
363
-
364
- /// <summary>
365
- /// Retrieves the name of the module/assembly the rule is from.
366
- /// </summary>
367
- public override string GetSourceName ( )
368
- {
369
- return string . Format ( CultureInfo . CurrentCulture , Strings . SourceName ) ;
370
- }
371
-
372
- /// <summary>
373
- /// Retrieves the type of the rule, Builtin, Managed or Module.
374
- /// </summary>
375
- public override SourceType GetSourceType ( )
376
- {
377
- return SourceType . Builtin ;
378
- }
379
381
}
380
382
}
0 commit comments