@@ -45,14 +45,15 @@ function runPatternBenchmarks(manifestPath, analyzers) {
4545 }
4646
4747 // Extract pattern IDs from findings
48- const foundPatterns = extractPatternIds ( findings ) ;
48+ const foundPatternsArray = extractPatternIds ( findings ) ;
49+ const foundPatterns = new Set ( foundPatternsArray ) ;
4950 const expectedPatterns = new Set ( expectations . expectedPatterns || [ ] ) ;
5051 const mustNotTrigger = new Set ( expectations . mustNotTrigger || [ ] ) ;
5152
5253 // Calculate metrics for this fixture
5354 const fixtureResult = {
5455 expected : Array . from ( expectedPatterns ) ,
55- found : foundPatterns ,
56+ found : foundPatternsArray ,
5657 truePositives : [ ] ,
5758 falsePositives : [ ] ,
5859 falseNegatives : [ ] ,
@@ -61,7 +62,7 @@ function runPatternBenchmarks(manifestPath, analyzers) {
6162
6263 // True positives: expected AND found
6364 for ( const pattern of expectedPatterns ) {
64- if ( foundPatterns . includes ( pattern ) ) {
65+ if ( foundPatterns . has ( pattern ) ) {
6566 fixtureResult . truePositives . push ( pattern ) ;
6667 results . summary . truePositives ++ ;
6768 updatePatternStats ( results . byPattern , pattern , 'tp' ) ;
@@ -83,7 +84,7 @@ function runPatternBenchmarks(manifestPath, analyzers) {
8384
8485 // Must-not-trigger violations
8586 for ( const pattern of mustNotTrigger ) {
86- if ( foundPatterns . includes ( pattern ) ) {
87+ if ( foundPatterns . has ( pattern ) ) {
8788 fixtureResult . mustNotTriggerViolations . push ( pattern ) ;
8889 }
8990 }
@@ -313,7 +314,7 @@ function extractPatternIds(findings) {
313314 for ( const f of findings ) {
314315 if ( f . patternId ) ids . push ( f . patternId ) ;
315316 }
316- } else if ( typeof findings === 'object' ) {
317+ } else if ( findings && typeof findings === 'object' ) {
317318 // Handle analyzer result objects with issue arrays
318319 for ( const value of Object . values ( findings ) ) {
319320 if ( Array . isArray ( value ) ) {
@@ -378,5 +379,6 @@ module.exports = {
378379 runFixBenchmarks,
379380 generateReport,
380381 assertThresholds,
381- extractPatternIds
382+ extractPatternIds,
383+ toPascalCase
382384} ;
0 commit comments