Sonar Cleanup - Phase 2

This commit is contained in:
Ean Milligan (Bastion) 2022-05-22 15:53:44 -04:00
parent 891a36a9ba
commit d6ec306792
2 changed files with 6 additions and 5 deletions

View File

@ -12,4 +12,5 @@ sonar.exclusions=emojis
sonar.sourceEncoding=UTF-8
# Exclusions for copy-paste detection
#sonar.cpd.exclusions=
# 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

View File

@ -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++;
}