junebug12851/pokered-save-editor

View on GitHub

Showing 58 of 2,664 total issues

CardPokemonComponent has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

@Component({
    selector: 'card-pokemon',
    templateUrl: './card-pokemon.component.pug',
    styleUrls: ['./card-pokemon.component.scss'],
})
Severity: Minor
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts - About 4 hrs to fix

File card-pokemon.component.ts has 325 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { OnInit, Output, EventEmitter } from '@angular/core';

/**
   Copyright 2018 June Hanabi

Severity: Minor
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts - About 3 hrs to fix

File PokemonBox.ts has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { SaveFileIterator } from './../SaveFileIterator';
import { SaveFileService } from './../../savefile.service';
import {Pokemon} from '../../../../assets/data/pokemon';
import { GameDataService } from '../../gameData.service';
import { PokemonDBService } from '../../pokemonDB.service';
Severity: Minor
Found in src/app/data/savefile-expanded/fragments/PokemonBox.ts - About 3 hrs to fix

Function onSpeciesChange has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public onSpeciesChange() {
        this.updateData();

        const species = this.pdb.pokemon[this.entry.species];
        if(species == undefined || species.name == undefined)
Severity: Minor
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function genPokemonAndGive has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    genPokemonAndGive(entry: EventPokemon) {
        // Get a blank Pokemon with random DV's and OT ID
        const pkmn = this.pkmn;

        // Get Pokemon Record
Severity: Minor
Found in src/app/screens/more-event-pokemon/more-event-pokemon.component.ts - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

SaveFileIterator has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

export class SaveFileIterator {
    constructor(saveFile: any) {
        this.saveFile = saveFile;
        this.state = [];
    }
Severity: Minor
Found in src/app/data/savefile-expanded/SaveFileIterator.ts - About 2 hrs to fix

SaveFileService has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

@Injectable({
    providedIn: 'root'
})
export class SaveFileService {

Severity: Minor
Found in src/app/data/savefile.service.ts - About 2 hrs to fix

StorageAllComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

@Component({
    selector: 'screen-storage-all',
    templateUrl: './storage-all.component.pug',
    styleUrls: ['./storage-all.component.scss'],
})
Severity: Minor
Found in src/app/screens/storage-all/storage-all.component.ts - About 2 hrs to fix

Function _rebuildMenu has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    _rebuildMenu(arr) {
        for (var i = 0; i < arr.length; i++) {
            const obj = arr[i];

            // Is not designated platform
Severity: Minor
Found in electron/AppMenu.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function movesList has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    get movesList() {

        // Gather applicable Learnset (If Any)
        let learnset = [];
        if(this.pokemonData !== undefined && this.pokemonData.initial !== undefined)
Severity: Minor
Found in src/app/fragments/select-moves/select-moves.component.ts - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function convertEngToHTML has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public convertEngToHTML(msg: string, maxChars: number, rival: string = "BLUE", player: string = "RED") {
        // Convert string to char codes
        let charCodes = Array.from(this.convertToCode(msg, maxChars, false));

        // Pre-pass
Severity: Major
Found in src/app/data/text.service.ts - About 2 hrs to fix

Function genPokemonAndGive has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    genPokemonAndGive(entry: EventPokemon) {
        // Get a blank Pokemon with random DV's and OT ID
        const pkmn = this.pkmn;

        // Get Pokemon Record
Severity: Major
Found in src/app/screens/more-event-pokemon/more-event-pokemon.component.ts - About 2 hrs to fix

Function process2Pokemon has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    process2Pokemon() {
        const self = this;

        _.forOwn(this.pokemon, function(value: any) {
            if(value.moves !== undefined) {
Severity: Major
Found in src/app/data/pokemonDB.service.ts - About 2 hrs to fix

Function convertEngToHTML has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public convertEngToHTML(msg: string, maxChars: number, rival: string = "BLUE", player: string = "RED") {
        // Convert string to char codes
        let charCodes = Array.from(this.convertToCode(msg, maxChars, false));

        // Pre-pass
Severity: Minor
Found in src/app/data/text.service.ts - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function save has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public save(saveFile: SaveFileService,
        startOffset: number,
        speciesStartOffset: number | null,
        nicknameStartOffset: number,
        otNameStartOffset: number,
Severity: Major
Found in src/app/data/savefile-expanded/fragments/PokemonBox.ts - About 2 hrs to fix

Function movesList has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    get movesList() {

        // Gather applicable Learnset (If Any)
        let learnset = [];
        if(this.pokemonData !== undefined && this.pokemonData.initial !== undefined)
Severity: Major
Found in src/app/fragments/select-moves/select-moves.component.ts - About 2 hrs to fix

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 mapList has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    get mapList() {

        const maps: Map[] = this.gd.file("maps").data;

        const b = (val: number | any) => {
Severity: Minor
Found in src/app/fragments/select-map-width/select-map-width.component.ts - About 1 hr to fix

Function newPokemon has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    static newPokemon(file: SaveFileService, pdb: PokemonDBService, gd: GameDataService) {
        const pkmn = new PokemonBox();
        const pkmnList = gd.file("randomPkmn").data;
        const pkmnData = pdb.pokemon[_.snakeCase(pkmnList[_.random(0, pkmnList.length, false)])];

Severity: Minor
Found in src/app/data/savefile-expanded/fragments/PokemonBox.ts - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function onSpeciesChange has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public onSpeciesChange() {
        this.updateData();

        const species = this.pdb.pokemon[this.entry.species];
        if(species == undefined || species.name == undefined)
Severity: Minor
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts - About 1 hr to fix
Severity
Category
Status
Source
Language