junebug12851/pokered-save-editor

View on GitHub

Showing 2,649 of 2,664 total issues

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 177.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 177.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

    get itemsFiltered() {
        const items = this.items;

        if (this.search == "")
            return items;
Severity: Major
Found in src/app/screens/world-hidden/world-hidden.component.ts and 2 other locations - About 3 hrs to fix
src/app/screens/world-missables/world-missables.component.ts on lines 45..56
src/app/screens/world-scripts/world-scripts.component.ts on lines 46..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    get missablesFiltered() {
        const missables = this.missables;

        if (this.search == "")
            return missables;
src/app/screens/world-hidden/world-hidden.component.ts on lines 49..60
src/app/screens/world-scripts/world-scripts.component.ts on lines 46..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    get scriptsFiltered() {
        const scripts = this.scripts;

        if (this.search == "")
            return scripts;
Severity: Major
Found in src/app/screens/world-scripts/world-scripts.component.ts and 2 other locations - About 3 hrs to fix
src/app/screens/world-hidden/world-hidden.component.ts on lines 49..60
src/app/screens/world-missables/world-missables.component.ts on lines 45..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    doMaxEVs() {
        this.entry.hpExp = 0xFFFF;
        this.entry.attackExp = 0xFFFF;
        this.entry.defenseExp = 0xFFFF;
        this.entry.speedExp = 0xFFFF;
Severity: Major
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts and 1 other location - About 2 hrs to fix
src/app/fragments/card-pokemon/card-pokemon.component.ts on lines 245..252

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    doResetEVs() {
        this.entry.hpExp = 0;
        this.entry.attackExp = 0;
        this.entry.defenseExp = 0;
        this.entry.speedExp = 0;
Severity: Major
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts and 1 other location - About 2 hrs to fix
src/app/fragments/card-pokemon/card-pokemon.component.ts on lines 228..235

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

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

            if(value.type !== undefined && value._type === undefined) {
                value._type = value.type;
                value.type = _.find(self.types, ['name', _.startCase(_.lowerCase(value.type))]);
            }
Severity: Major
Found in src/app/data/pokemonDB.service.ts and 3 other locations - About 2 hrs to fix
src/app/data/pokemonDB.service.ts on lines 136..139
src/app/data/pokemonDB.service.ts on lines 141..144
src/app/data/pokemonDB.service.ts on lines 148..151

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            if(value.type1 !== undefined && value._type1 === undefined) {
                value._type1 = value.type1;
                value.type1 = _.find(self.types, ['name', _.startCase(_.lowerCase(value.type1))]);
            }
Severity: Major
Found in src/app/data/pokemonDB.service.ts and 3 other locations - About 2 hrs to fix
src/app/data/pokemonDB.service.ts on lines 90..93
src/app/data/pokemonDB.service.ts on lines 141..144
src/app/data/pokemonDB.service.ts on lines 148..151

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            if(value.type2 !== undefined && value._type2 === undefined) {
                value._type2 = value.type2;
                value.type2 = _.find(self.types, ['name', _.startCase(_.lowerCase(value.type2))]);
            }
Severity: Major
Found in src/app/data/pokemonDB.service.ts and 3 other locations - About 2 hrs to fix
src/app/data/pokemonDB.service.ts on lines 90..93
src/app/data/pokemonDB.service.ts on lines 136..139
src/app/data/pokemonDB.service.ts on lines 148..151

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                    if(entry.item !== undefined && entry._item === undefined) {
                        entry._item = entry.item;
                        entry.item = _.find(self.items, ['name', _.startCase(_.lowerCase(entry.item))]);
                    }
Severity: Major
Found in src/app/data/pokemonDB.service.ts and 3 other locations - About 2 hrs to fix
src/app/data/pokemonDB.service.ts on lines 90..93
src/app/data/pokemonDB.service.ts on lines 136..139
src/app/data/pokemonDB.service.ts on lines 141..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    get isMinEVs() {
        return this.entry.hpExp == 0 &&
            this.entry.attackExp == 0 &&
            this.entry.defenseExp == 0 &&
            this.entry.speedExp == 0 &&
Severity: Major
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts and 1 other location - About 2 hrs to fix
src/app/fragments/card-pokemon/card-pokemon.component.ts on lines 220..226

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 87.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    get isMaxEVs() {
        return this.entry.hpExp == 0xFFFF &&
            this.entry.attackExp == 0xFFFF &&
            this.entry.defenseExp == 0xFFFF &&
            this.entry.speedExp == 0xFFFF &&
Severity: Major
Found in src/app/fragments/card-pokemon/card-pokemon.component.ts and 1 other location - About 2 hrs to fix
src/app/fragments/card-pokemon/card-pokemon.component.ts on lines 237..243

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 87.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language