Function convertEngToHTML
has 56 lines of code (exceeds 25 allowed). Consider refactoring.
public convertEngToHTML(msg: string, maxChars: number, rival: string = "BLUE", player: string = "RED") {
let charCodes = Array.from(this.convertToCode(msg, maxChars, false));
Function convertEngToHTML
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
public convertEngToHTML(msg: string, maxChars: number, rival: string = "BLUE", player: string = "RED") {
let charCodes = Array.from(this.convertToCode(msg, maxChars, false));
Similar blocks of code found in 7 locations. Consider refactoring.
else if (char === 0x5A) {
const str = Array.from(this.convertToCode("Enemy BLASTOISE", 100, false));
charCodes.splice(i, 1, ...str);
}
Similar blocks of code found in 7 locations. Consider refactoring.
else if (char === 0x5B) {
const str = Array.from(this.convertToCode("PC", 100, false));
charCodes.splice(i, 1, ...str);
}
Similar blocks of code found in 7 locations. Consider refactoring.
else if (char === 0x56) {
const str = Array.from(this.convertToCode("<...><...>", 10, false));
charCodes.splice(i, 1, ...str);
}
Similar blocks of code found in 7 locations. Consider refactoring.
else if (char === 0x5D) {
const str = Array.from(this.convertToCode("TRAINER", 100, false));
charCodes.splice(i, 1, ...str);
}
Similar blocks of code found in 7 locations. Consider refactoring.
else if (char === 0x54) {
const str = Array.from(this.convertToCode("POK<e>", 10, false));
charCodes.splice(i, 1, ...str);
}
Similar blocks of code found in 7 locations. Consider refactoring.
else if (char === 0x59) {
const str = Array.from(this.convertToCode("CHARIZARD", 100, false));
charCodes.splice(i, 1, ...str);
}
Similar blocks of code found in 7 locations. Consider refactoring.
else if (char === 0x5C) {
const str = Array.from(this.convertToCode("TM", 100, false));
charCodes.splice(i, 1, ...str);
}
Similar blocks of code found in 2 locations. Consider refactoring.
else if (char === 0x53) {
const rivalName = Array.from(this.convertToCode(rival, 7, false));
charCodes.splice(i, 1, ...rivalName);
}
Similar blocks of code found in 2 locations. Consider refactoring.
else if (char === 0x52) {
const playerName = Array.from(this.convertToCode(player, 7, false));
charCodes.splice(i, 1, ...playerName);
}
misplaced 'else'
else if (char === 0x5E) {
comment must start with a space
if statements must be braced
if (this.indToEng[char].useTilemap)
fontStr.push(`<div class="pr pr-pic pr-${char.toString(16).toUpperCase().padStart(2, "0")}"></div>`);
misplaced 'else'
else if (char === 0x52) {
" should be '
const str = Array.from(this.convertToCode("PC", 100, false));
" should be '
const str = Array.from(this.convertToCode("TRAINER", 100, false));
if statements must be braced
if (this.indToEng[code] === undefined)
continue;
misplaced 'else'
else if (char === 0x5A) {
" should be '
return new TextSearch(this.gd.file("text").data);
" should be '
fontStr.push(`<div class="pr pr-pic pr-${char.toString(16).toUpperCase().padStart(2, "0")}"></div>`);
if statements must be braced
if (code.length === maxLength ||
lastCode === 0x50)
break;
if statements must be braced
if ((typeof str !== 'string') && autoEnd)
return new Uint8Array([0x50]);
misplaced 'else'
else if (char === 0x5D) {
if statements must be braced
if (!str.startsWith(transPair.eng))
continue;
misplaced 'else'
else if (char === 0x53) {
misplaced 'else'
else if (char === 0x56) {
misplaced 'else'
else if (char === 0x59) {
" should be '
const text: Text[] = this.gd.file("text").data;
" should be '
public convertEngToHTML(msg: string, maxChars: number, rival: string = "BLUE", player: string = "RED") {
" should be '
const str = Array.from(this.convertToCode("POK<e>", 10, false));
" should be '
const str = Array.from(this.convertToCode("ROCKET", 100, false));
if statements must be braced
if (autoEnd)
code.push(0x50);
if statements must be braced
if (i === maxLength)
break;
else statements must be braced
else
fontStr.push(`<div class="pr pr-${char.toString(16).toUpperCase().padStart(2, "0")}"></div>`);
" should be '
let eng = "";
" should be '
public convertEngToHTML(msg: string, maxChars: number, rival: string = "BLUE", player: string = "RED") {
" should be '
const str = Array.from(this.convertToCode("CHARIZARD", 100, false));
misplaced 'else'
else if (char === 0x5B) {
Identifier 'code' is never reassigned; use 'const' instead of 'let'.
let code = [];
Identifier 'charCodes' is never reassigned; use 'const' instead of 'let'.
let charCodes = Array.from(this.convertToCode(msg, maxChars, false));
if statements must be braced
if (match === false)
str = str.substring(1);
if statements must be braced
else if ((typeof str !== 'string') && !autoEnd)
return new Uint8Array();
" should be '
const str = Array.from(this.convertToCode("TM", 100, false));
" should be '
fontStr.push(`<div class="pr pr-${char.toString(16).toUpperCase().padStart(2, "0")}"></div>`);
misplaced 'else'
else if (char === 0x54) {
misplaced 'else'
else if (char === 0x5C) {
" should be '
const str = Array.from(this.convertToCode("<...><...>", 10, false));
if statements must be braced
if (code === 0x50)
break;
" should be '
const str = Array.from(this.convertToCode("Enemy BLASTOISE", 100, false));
There are no issues that match your filters.