@@ -310,45 +310,37 @@ private IEnumerable<Rule> GetRulesForLanguages(string[] languages)
310
310
}
311
311
312
312
/// <summary>
313
- /// Check if rule tags have already been seen or if exception exists
313
+ /// Check if rule has at least one unique tag not seen before or if exception exists
314
314
/// Assumes that _uniqueTagsOnly == true has been checked first for relevance
315
315
/// </summary>
316
316
/// <param name="ruleTags"></param>
317
317
/// <returns></returns>
318
318
private bool UniqueTagsCheck ( string [ ] ruleTags )
319
319
{
320
- bool approved = true ;
320
+ bool approved = false ;
321
321
322
322
foreach ( string tag in ruleTags )
323
323
{
324
- if ( _uniqueTagHashes . Contains ( tag ) )
324
+ if ( ! _uniqueTagHashes . Contains ( tag ) )
325
325
{
326
- approved = false ;
327
- if ( UniqueTagExceptions != null )
326
+ approved = true ;
327
+ break ;
328
+ }
329
+ else if ( UniqueTagExceptions != null )
330
+ {
331
+ foreach ( string tagException in UniqueTagExceptions )
328
332
{
329
- foreach ( string tagException in UniqueTagExceptions )
333
+ if ( tag . Contains ( tagException ) )
330
334
{
331
- approved = tag . Contains ( tagException ) ;
332
- if ( approved )
333
- {
334
- break ;
335
- }
335
+ approved = true ;
336
+ break ;
336
337
}
337
- }
338
-
339
- if ( _logger != null && ! approved )
340
- {
341
- _logger . Debug ( string . Format ( "Duplicate tag {0} not added" , tag ) ) ;
342
- }
343
-
344
- break ;
338
+ }
345
339
}
346
- else
340
+
341
+ if ( _logger != null && ! approved )
347
342
{
348
- if ( _logger != null )
349
- {
350
- _logger . Debug ( string . Format ( "Unique tag {0} added" , tag ) ) ;
351
- }
343
+ _logger . Debug ( string . Format ( "Duplicate tag {0} not approved for match" , tag ) ) ;
352
344
}
353
345
}
354
346
@@ -364,10 +356,14 @@ private void AddRuleTagHashes(string[] ruleTags)
364
356
{
365
357
foreach ( string t in ruleTags )
366
358
{
367
- _uniqueTagHashes . Add ( t ) ;
359
+ bool added = _uniqueTagHashes . Add ( t ) ;
360
+ if ( _logger != null && added )
361
+ {
362
+ _logger . Debug ( string . Format ( "Unique tag {0} added" , t ) ) ;
363
+ }
368
364
}
369
365
}
370
366
371
367
#endregion Private Methods
372
368
}
373
- }
369
+ }
0 commit comments