@@ -282,15 +282,15 @@ private void AnalyzeFile(string filePath)
282
282
{
283
283
foreach ( string rule in includeRule )
284
284
{
285
- Regex includeRegex = new Regex ( rule . Replace ( " *", ".*?" ) , RegexOptions . IgnoreCase ) ;
285
+ Regex includeRegex = new Regex ( String . Format ( "^{0}$" , Regex . Escape ( rule ) . Replace ( @"\ *", ".*" ) ) , RegexOptions . IgnoreCase ) ;
286
286
includeRegexList . Add ( includeRegex ) ;
287
287
}
288
288
}
289
289
if ( excludeRule != null )
290
290
{
291
291
foreach ( string rule in excludeRule )
292
292
{
293
- Regex excludeRegex = new Regex ( rule . Replace ( " *", ".*?" ) , RegexOptions . IgnoreCase ) ;
293
+ Regex excludeRegex = new Regex ( String . Format ( "^{0}$" , Regex . Escape ( rule ) . Replace ( @"\ *", ".*" ) ) , RegexOptions . IgnoreCase ) ;
294
294
excludeRegexList . Add ( excludeRegex ) ;
295
295
}
296
296
}
@@ -361,8 +361,7 @@ private void AnalyzeFile(string filePath)
361
361
break ;
362
362
}
363
363
}
364
- if ( ( includeRule == null || includeRule . Contains ( scriptRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || includeRegexMatch ) &&
365
- ( excludeRule == null || ! excludeRule . Contains ( scriptRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || ! excludeRegexMatch ) )
364
+ if ( ( includeRule == null || includeRegexMatch ) && ( excludeRule == null || ! excludeRegexMatch ) )
366
365
{
367
366
WriteVerbose ( string . Format ( CultureInfo . CurrentCulture , Strings . VerboseRunningMessage , scriptRule . GetName ( ) ) ) ;
368
367
@@ -435,10 +434,9 @@ private void AnalyzeFile(string filePath)
435
434
{
436
435
excludeRegexMatch = true ;
437
436
break ;
438
- }
437
+ }
439
438
}
440
- if ( ( includeRule == null || includeRule . Contains ( commandRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || includeRegexMatch ) &&
441
- ( excludeRule == null || ! excludeRule . Contains ( commandRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || ! excludeRegexMatch ) )
439
+ if ( ( includeRule == null || includeRegexMatch ) && ( excludeRule == null || ! excludeRegexMatch ) )
442
440
{
443
441
foreach ( KeyValuePair < CommandInfo , IScriptExtent > commandInfo in cmdInfoTable )
444
442
{
@@ -485,8 +483,7 @@ private void AnalyzeFile(string filePath)
485
483
break ;
486
484
}
487
485
}
488
- if ( ( includeRule == null || includeRule . Contains ( tokenRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || includeRegexMatch ) &&
489
- ( excludeRule == null || ! excludeRule . Contains ( tokenRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) ) || ! excludeRegexMatch )
486
+ if ( ( includeRule == null || includeRegexMatch ) && ( excludeRule == null || ! excludeRegexMatch ) )
490
487
{
491
488
WriteVerbose ( string . Format ( CultureInfo . CurrentCulture , Strings . VerboseRunningMessage , tokenRule . GetName ( ) ) ) ;
492
489
@@ -530,8 +527,7 @@ private void AnalyzeFile(string filePath)
530
527
break ;
531
528
}
532
529
}
533
- if ( ( includeRule == null || includeRule . Contains ( dscResourceRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || includeRegexMatch ) &&
534
- ( excludeRule == null || ! excludeRule . Contains ( dscResourceRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || excludeRegexMatch ) )
530
+ if ( ( includeRule == null || includeRegexMatch ) && ( excludeRule == null || excludeRegexMatch ) )
535
531
{
536
532
WriteVerbose ( string . Format ( CultureInfo . CurrentCulture , Strings . VerboseRunningMessage , dscResourceRule . GetName ( ) ) ) ;
537
533
@@ -588,8 +584,7 @@ private void AnalyzeFile(string filePath)
588
584
excludeRegexMatch = true ;
589
585
}
590
586
}
591
- if ( ( includeRule == null || includeRule . Contains ( dscResourceRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || includeRegexMatch ) &&
592
- ( excludeRule == null || ! excludeRule . Contains ( dscResourceRule . GetName ( ) , StringComparer . OrdinalIgnoreCase ) || ! excludeRegexMatch ) )
587
+ if ( ( includeRule == null || includeRegexMatch ) && ( excludeRule == null || ! excludeRegexMatch ) )
593
588
{
594
589
WriteVerbose ( string . Format ( CultureInfo . CurrentCulture , Strings . VerboseRunningMessage , dscResourceRule . GetName ( ) ) ) ;
595
590
0 commit comments