uccser/cs-field-guide

View on GitHub
csfieldguide/static/interactives/packet-attack/js/game.js

Summary

Maintainability
F
1 wk
Test Coverage

File game.js has 619 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Packet Attack
 * 
 * Main Gameplay Classes
 */
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 1 day to fix

GameScene has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class GameScene extends Phaser.Scene {

    constructor() {
        super({ key: 'GameScene'});
    }
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 3 hrs to fix

Function create has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    create() {
        console.log('creating UI');

        var textConfig = {
            font: '40px Open Sans',
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 2 hrs to fix

Function updateReceivedMessage has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    updateReceivedMessage() {
        var message = [];
        if (this.level.packetsHaveNumbers) {
            for (var j=0; j < this.level.message.length; j++) {
                message.push('');
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.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 init has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init() {
        this.receivedMessage;
        this.sendChars;
        this.receivedPackets;
        this.level;
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 1 hr to fix

Function recreate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    recreate() {
        this.receivedMessage = '';
        this.sendChars = this.level.message.split('');
        this.receivedPackets = [];

Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 1 hr to fix

Function create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    create() {
        console.log('Adding base images and animations');
        this.add.image(400, 300, 'bg');

        var animationConfig = {
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 1 hr to fix

Function updateReceivedMessage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    updateReceivedMessage() {
        var message = [];
        if (this.level.packetsHaveNumbers) {
            for (var j=0; j < this.level.message.length; j++) {
                message.push('');
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 1 hr to fix

Function doCommand has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    doCommand(command, scene, packetList) {
        var packet;
        for (var i=0; i < packetList.length; i++) {
            packet = packetList[i];
            if (packet.checkInDanger() && !packet.killed) {
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 45 mins 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 timerEnd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    timerEnd(packet) {

        if (this.level.timeoutsEnabled) {
            if (this.unansweredPacketNumbers.indexOf(packet.number) >= 0) {
                if (!packet.isCorrupt || !this.level.acksNacksEnabled) {
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 35 mins 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 corrupt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    corrupt(scene, doCorrupt) {
        if (doCorrupt && scene.remainingCorrupts > 0) {
            if (!scene.doCommand(PACKET.PacketCommands.CORRUPT, scene, scene.activePackets) && scene.level.canAttackAcksNacks) {
                if (!scene.doCommand(PACKET.PacketCommands.CORRUPT, scene, scene.activeAcks)) {
                    scene.doCommand(PACKET.PacketCommands.CORRUPT, scene, scene.activeNacks);
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 25 mins 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 delay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    delay(scene, doDelay) {
        if (doDelay && scene.remainingDelays > 0) {
            if (!scene.doCommand(PACKET.PacketCommands.DELAY, scene, scene.activePackets) && scene.level.canAttackAcksNacks) {
                if (!scene.doCommand(PACKET.PacketCommands.DELAY, scene, scene.activeAcks)) {
                    scene.doCommand(PACKET.PacketCommands.DELAY, scene, scene.activeNacks);
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 25 mins 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 interpretNewPacket has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    interpretNewPacket(packet) {
        if (this.level.acksNacksEnabled) {
            if (this.level.packetsHaveNumbers && this.alreadyReceived(packet.number)) {
                this.sendAck(packet);
                return;
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 25 mins 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 kill has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    kill(scene, doKill) {
        if (doKill && scene.remainingKills > 0) {
            if (!scene.doCommand(PACKET.PacketCommands.KILL, scene, scene.activePackets) && scene.level.canAttackAcksNacks) {
                if (!scene.doCommand(PACKET.PacketCommands.KILL, scene, scene.activeAcks)) {
                    scene.doCommand(PACKET.PacketCommands.KILL, scene, scene.activeNacks);
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 25 mins 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 3 locations. Consider refactoring.
Open

    delay(scene, doDelay) {
        if (doDelay && scene.remainingDelays > 0) {
            if (!scene.doCommand(PACKET.PacketCommands.DELAY, scene, scene.activePackets) && scene.level.canAttackAcksNacks) {
                if (!scene.doCommand(PACKET.PacketCommands.DELAY, scene, scene.activeAcks)) {
                    scene.doCommand(PACKET.PacketCommands.DELAY, scene, scene.activeNacks);
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 4 hrs to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 472..480
csfieldguide/static/interactives/packet-attack/js/game.js on lines 488..496

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 132.

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

    corrupt(scene, doCorrupt) {
        if (doCorrupt && scene.remainingCorrupts > 0) {
            if (!scene.doCommand(PACKET.PacketCommands.CORRUPT, scene, scene.activePackets) && scene.level.canAttackAcksNacks) {
                if (!scene.doCommand(PACKET.PacketCommands.CORRUPT, scene, scene.activeAcks)) {
                    scene.doCommand(PACKET.PacketCommands.CORRUPT, scene, scene.activeNacks);
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 4 hrs to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 456..464
csfieldguide/static/interactives/packet-attack/js/game.js on lines 488..496

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 132.

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

    kill(scene, doKill) {
        if (doKill && scene.remainingKills > 0) {
            if (!scene.doCommand(PACKET.PacketCommands.KILL, scene, scene.activePackets) && scene.level.canAttackAcksNacks) {
                if (!scene.doCommand(PACKET.PacketCommands.KILL, scene, scene.activeAcks)) {
                    scene.doCommand(PACKET.PacketCommands.KILL, scene, scene.activeNacks);
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 4 hrs to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 456..464
csfieldguide/static/interactives/packet-attack/js/game.js on lines 472..480

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 132.

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

    updateKills(scene, number) {
        scene.killRemainder.setText(TXT_USES + ' ' + number);

        if (number <=0) {
            scene.kill.alpha = 0.5;
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 4 hrs to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 778..788
csfieldguide/static/interactives/packet-attack/js/game.js on lines 795..805

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 117.

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

    updateCorrupts(scene, number) {
        scene.corruptRemainder.setText(TXT_USES + ' ' + number);

        if (number <=0) {
            scene.corrupt.alpha = 0.5;
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 4 hrs to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 778..788
csfieldguide/static/interactives/packet-attack/js/game.js on lines 812..822

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 117.

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

    updateDelays(scene, number) {
        scene.delayRemainder.setText(TXT_USES + ' ' + number);

        if (number <=0) {
            scene.delay.alpha = 0.5;
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 4 hrs to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 795..805
csfieldguide/static/interactives/packet-attack/js/game.js on lines 812..822

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 117.

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.scene.paused) {
            this.scene.scene.resume('GameScene');
            this.scene.playpause.setTexture('pause');
            this.scene.paused = false;
            console.log('resumed');
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 1 other location - About 1 hr to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 876..881

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 67.

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

        } else {
            this.scene.scene.pause('GameScene');
            this.scene.playpause.setTexture('play');
            this.scene.paused = true;
            console.log('paused');
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 1 other location - About 1 hr to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 871..876

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 67.

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

        var corruptButtonConfig = {
            scene: this,
            x: 400,
            y: 520,
            imageKey: 'corrupt',
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 35 mins to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 693..701
csfieldguide/static/interactives/packet-attack/js/game.js on lines 725..733

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 46.

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

        var killButtonConfig = {
            scene: this,
            x: 590,
            y: 520,
            imageKey: 'kill',
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 35 mins to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 693..701
csfieldguide/static/interactives/packet-attack/js/game.js on lines 709..717

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 46.

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

        var delayButtonConfig = {
            scene: this,
            x: 215,
            y: 520,
            imageKey: 'delay',
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 2 other locations - About 35 mins to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 709..717
csfieldguide/static/interactives/packet-attack/js/game.js on lines 725..733

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 46.

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

    registryUpdate(parent, key, data) {
        if (this.handlers[key]) {
            this.handlers[key](this, data);
        }
    }
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 1 other location - About 35 mins to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 748..752

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 46.

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

    registryUpdate(parent, key, data) {
        if (this.handlers[key]) {
            this.handlers[key](this, data);
        }
    }
Severity: Minor
Found in csfieldguide/static/interactives/packet-attack/js/game.js and 1 other location - About 35 mins to fix
csfieldguide/static/interactives/packet-attack/js/game.js on lines 198..202

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 46.

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

There are no issues that match your filters.

Category
Status