UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

21 lines (17 loc) 666 B
/** * @file Calculate confidence in duplication classification * @description Single responsibility: Compute confidence score for classification */ function calculateConfidence(diffTypes, avgDiffs) { // Higher confidence when differences follow clear patterns const total = diffTypes.total || 1; const maxRatio = Math.max( diffTypes.variableNames / total, diffTypes.stringLiterals / total, diffTypes.numbers / total ); // Lower confidence with more structural differences const structuralRatio = diffTypes.structure / total; return Math.max(0.1, Math.min(1.0, maxRatio - structuralRatio)); } module.exports = calculateConfidence;