junebug12851/pokered-save-editor

View on GitHub
src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts

Summary

Maintainability
D
2 days
Test Coverage

Showing 20 of 20 total issues

Function load has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public load(saveFile: SaveFileService) {
this.pauseWildEncounters3Steps = saveFile.getBit(0x29D8, 1, 0);
this.grassRate = saveFile.getByte(0x2B33);
 
// Load Grass Pokemon only if there's an encounter rate for it
Severity: Minor
Found in src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts - About 1 hr to fix

Function load has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

public load(saveFile: SaveFileService) {
this.pauseWildEncounters3Steps = saveFile.getBit(0x29D8, 1, 0);
this.grassRate = saveFile.getByte(0x2B33);
 
// Load Grass Pokemon only if there's an encounter rate for it
Severity: Minor
Found in src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts - About 1 hr to fix

Function save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

public save(saveFile: SaveFileService) {
const it = saveFile.iterator;
 
saveFile.setBit(0x29D8, 1, 0, this.pauseWildEncounters3Steps);
 
 
Severity: Minor
Found in src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts - About 25 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if(this.grassRate > 0) {
const grassPokemon = saveFile.getRange(0x2B34, 20);
 
this.grassPokemon = [];
for (let i = 0; i < 20; i += 2) {
Severity: Major
Found in src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts and 1 other location - About 7 hrs to fix
src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts on lines 45..66

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if(this.waterPokemonRate > 0) {
const waterPokemon = saveFile.getRange(0x2B51, 20);
 
this.waterPokemon = [];
for (let i = 0; i < 20; i += 2) {
Severity: Major
Found in src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts and 1 other location - About 7 hrs to fix
src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts on lines 19..40

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if(this.grassRate > 0) {
it.offsetTo(0x2B34);
for (let i = 0; i < 10; i++) {
it.setByte(this.grassPokemon[i].level);
it.setByte(this.grassPokemon[i].pokemon);
Severity: Major
Found in src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts and 1 other location - About 3 hrs to fix
src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts on lines 88..94

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if(this.waterPokemonRate > 0) {
it.offsetTo(0x2B51);
for (let i = 0; i < 10; i++) {
it.setByte(this.waterPokemon[i].level);
it.setByte(this.waterPokemon[i].pokemon);
Severity: Major
Found in src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts and 1 other location - About 3 hrs to fix
src/app/data/savefile-expanded/sections/Area/AreaPokemon.ts on lines 77..83

if statements must be braced
Open

if (saveFile !== undefined)
this.load(saveFile as SaveFileService);

Type number trivially inferred from a number literal, remove type annotation
Open

public waterPokemonRate: number = 0;

Type number trivially inferred from a number literal, remove type annotation
Open

public grassRate: number = 0;

misplaced 'else'
Open

else {

missing whitespace
Open

if(this.waterPokemonRate > 0) {

Type boolean trivially inferred from a boolean literal, remove type annotation
Open

public pauseWildEncounters3Steps: boolean = false;

missing whitespace
Open

if(this.grassRate > 0) {

missing whitespace
Open

if(this.waterPokemonRate > 0) {

misplaced 'else'
Open

else {

Properties should be separated by semicolons
Open

level: number,

Properties should be separated by semicolons
Open

pokemon: number,

Unnecessary semicolon
Open

};

missing whitespace
Open

if(this.grassRate > 0) {

There are no issues that match your filters.

Category
Status