diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 6bded21..ad4cf42 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -12,4 +12,5 @@ sonar.exclusions=emojis sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -#sonar.cpd.exclusions= \ No newline at end of file +# constantCmds.ts is excluded to get rid of the duplicate code compliant. Sonar does not like you initializing JSON in ts files. +sonar.cpd.exclusions=src/constantCmds.ts \ No newline at end of file diff --git a/src/solver/roller.ts b/src/solver/roller.ts index 995439c..d6b68ac 100644 --- a/src/solver/roller.ts +++ b/src/solver/roller.ts @@ -445,16 +445,16 @@ export const roll = (rollStr: string, maximiseRoll: boolean, nominalRoll: boolea // Count how many rerolled dice there are if the reroll flag was on let rerollCount = 0; if (rollConf.reroll.on) { - for (let i = 0; i < rollSet.length; i++) { + for (let j = 0; j < rollSet.length; j++) { // If loopCount gets too high, stop trying to calculate infinity if (loopCount > MAXLOOPS) { throw new Error('MaxLoopsExceeded'); } - log(LT.LOG, `Handling roll ${rollStr} | Setting originalIdx on ${JSON.stringify(rollSet[i])}`); - rollSet[i].origidx = i; + log(LT.LOG, `Handling roll ${rollStr} | Setting originalIdx on ${JSON.stringify(rollSet[j])}`); + rollSet[j].origidx = j; - if (rollSet[i].rerolled) { + if (rollSet[j].rerolled) { rerollCount++; }