uccser/cs-field-guide

View on GitHub
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js

Summary

Maintainability
F
1 wk
Test Coverage

Function assemble has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

function assemble() {
    LABELS = [];
    LABELADDRS = [];
    var targetIndex;

Severity: Minor
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 1 day 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

File mips-assembler.js has 700 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Partial MIPS I Assembler based on the work of Alan Hogan
 * https://github.com/alanhogan/online-mips-assembler
 * Licensed under CC BY-NC-SA 4.0
 */

Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 1 day to fix

Function assemble has 218 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function assemble() {
    LABELS = [];
    LABELADDRS = [];
    var targetIndex;

Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 1 day to fix

Function buildInstructionR has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

function buildInstructionR(args) {
    var returnList;
    var opcode = args[0];
    var tempReg;
    var dest;
Severity: Minor
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 5 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 register has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function register(reg) {
    var returnVal;
    switch(reg) {
        case "zero":
        case "0":
Severity: Minor
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - 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 buildInstructionI has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

function buildInstructionI(args) {
    var returnList;
    var opcode = args[0];
    var tempReg;
    var dest;
Severity: Minor
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - 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 buildInstructionR has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function buildInstructionR(args) {
    var returnList;
    var opcode = args[0];
    var tempReg;
    var dest;
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 2 hrs to fix

Function instructionType has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function instructionType(opcode) {
    switch(opcode) {
        // Type R Shifts
        case "sll":
        case "srl":
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 2 hrs to fix

Function register has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function register(reg) {
    var returnVal;
    switch(reg) {
        case "zero":
        case "0":
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 2 hrs to fix

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

function buildInstructionI(args) {
    var returnList;
    var opcode = args[0];
    var tempReg;
    var dest;
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 2 hrs to fix

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

function splitEvery(num, text) {
    var returnLines = [];
    var returnHexes = [];
    var subtext = "";
    var subhex = "";

Function encodingR has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function encodingR(opcode) {
    var returnVal;
    switch(opcode) {
        case("sll"):
            returnVal = 0; break;

Function hexR has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function hexR(opcode, rs, rt, rd, shamt, func) {
Severity: Minor
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (showBlank) {
                instructions.push([TYPE_UNASSIGNED, nextInstr, input, instructionAddr, line]);
            }
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        } else if (last(line.split("")) == ":") {
            // Interpret as a pointer name; e.g. function name or loop point
            var name = line.substr(0, line.length - 1);
            LABELS.push(name);
            LABELADDRS.push(instructionAddr);
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (showInstr) {
                nextInstr = "; |" + colour(TXT_INPUT + ":" + input, COLOUR_INPUT) + "| " + colour(last(storedTextNames), COLOUR_LABEL) + line.substr(colonIndex) + "<br>";
            } else {
                nextInstr = colour(last(storedTextNames), COLOUR_LABEL) + line.substr(colonIndex) + "<br>";
            }
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 45 mins to fix

Function splitEvery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function splitEvery(num, text) {
    var returnLines = [];
    var returnHexes = [];
    var subtext = "";
    var subhex = "";
Severity: Minor
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.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

Avoid too many return statements within this function.
Open

    return returnList;
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_BADREGISTER, tempreg];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return returnList;
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_BADREGISTER, tempReg];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_BADREGISTER, tempReg];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_BADREGISTER, tempReg];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return(TYPE_BADREGISTER, tempReg);
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return [TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return f[TYPE_INVALID, args[0]];
Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 30 mins to fix

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

function binOfStr(text, n) {
    var returnString = "";
    var chars = text.split("");
    for (var i=0; i < chars.length; i++) {
        if (chars[i] == "\\" && chars[i+1] == "n") {
Severity: Minor
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.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 2 locations. Consider refactoring.
Open

            if (keywords[0] == "move" && keywords.length == 3) {
                // move is supported with template (move $ab, $cd == add $ab, $zero, $cd)
                keywords[0] = "add";
                keywords.push(keywords[2]);
                keywords[2] = "$zero,";
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 165..171

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 2 locations. Consider refactoring.
Open

            if (keywords[0] == "li" && keywords.length == 3) {
                // li is supported with template (li $xy, z == addiu $xy, $zero, z)
                keywords[0] = "addiu";
                keywords.push(keywords[2]);
                keywords[2] = "$zero,";
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 209..215

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

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

                if (showInstr) {
                    printText += colour(rawVal(addr), COLOUR_ADDR) + ": " + colour(rawVal(instrHex), COLOUR_INSTR) + " ; |" + colour(TXT_INPUT + ":" + input, COLOUR_INPUT) + "| " + colour(orig, COLOUR_INSTR) + "<br>";
                } else {
                    printText += colour(rawVal(instrHex), COLOUR_INSTR) + "<br>";
                }
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 258..262
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 272..276

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

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

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

                if (showInstr) {
                    printText += colour(rawVal(addr), COLOUR_ADDR) + ": " + colour(rawVal(instrHex), COLOUR_INSTR) + " ; |" + colour(TXT_INPUT + ":" + input, COLOUR_INPUT) + "| " + colour(orig, COLOUR_INSTR) + "<br>";
                } else {
                    printText += colour(rawVal(instrHex), COLOUR_INSTR) + "<br>";
                }
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 258..262
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 280..284

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

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

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

                if (showInstr) {
                    printText += colour(rawVal(addr), COLOUR_ADDR) + ": " + colour(rawVal(instrHex), COLOUR_INSTR) + " ; |" + colour(TXT_INPUT + ":" + input, COLOUR_INPUT) + "| " + colour(orig, COLOUR_INSTR) + "<br>";
                } else {
                    printText += colour(rawVal(instrHex), COLOUR_INSTR) + "<br>";
                }
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 272..276
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 280..284

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

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

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

    if (args.length == 4 && args[1].startsWith("$")) {
        if (last(args[1].split("")) == ",") {
            tempReg = args[1].substr(1, args[1].length - 2);
        } else {
            tempReg = args[1].substr(1)
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 661..670

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

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

    if (args.length >= 2 && args[1].startsWith("$")) {
        if (last(args[1].split("")) == ",") {
            tempReg = args[1].substr(1, args[1].length - 2);
        } else {
            tempReg = args[1].substr(1);
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 760..769

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

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

        if (args[2].startsWith("$") && last(args[2].split("")) == ",") {
            tempReg = args[2].substr(1, args[2].length - 2);
        } else {
            return [TYPE_INVALID, args[0]];
        }
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 780..784

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

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

        if (args[2].startsWith("$") && last(args[2].split("")) == ",") {
            tempReg = args[2].substr(1, args[2].length - 2);
        } else {
            return [TYPE_INVALID, args[0]];
        }
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 692..696

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 3 locations. Consider refactoring.
Open

function binOfInt(num, n) {
    var returnString = num.toString(2);
    if (returnString.length < n) {
        return "0".repeat(n - returnString.length) + returnString;
    } else {
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 489..496
csfieldguide/static/interactives/mips-simulator/js/mips-simulator.js on lines 265..272

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

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

function hexOfInt(num, n) {
    var returnString = num.toString(16);
    if (returnString.length < n) {
        return "0".repeat(n - returnString.length) + returnString;
    } else {
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 450..457
csfieldguide/static/interactives/mips-simulator/js/mips-simulator.js on lines 265..272

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

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

            case (TYPE_UNSUPPORTED):
                printText += "; " + colour(TXT_UNSUPPORTED, COLOUR_BAD) + ": " + instrArgs[1] + " ; |" + colour(TXT_INPUT + ":" + input, COLOUR_INPUT) + "| " + colour(orig, COLOUR_INSTR) + "<br>";
                break;
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 289..291

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

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

            case (TYPE_BADREGISTER):
                printText += "; " + colour(TXT_INVALID, COLOUR_BAD) + ": " + instrArgs[1] + " ; |" + colour(TXT_INPUT + ":" + input, COLOUR_INPUT) + "| " + colour(orig, COLOUR_INSTR) + "<br>";
                break;
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 286..288

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

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

    $('#reset-adv').on('click', function () {
        $('#mips-input').val(advancedProgram);
        $('#assembler-output').html('');
    });
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 56..59
csfieldguide/static/interactives/mips-simulator/js/mips-simulator.js on lines 81..84
csfieldguide/static/interactives/mips-simulator/js/mips-simulator.js on lines 86..89

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

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

    $('#reset-basic').on('click', function () {
        $('#mips-input').val(basicProgram);
        $('#assembler-output').html('');
    });
csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js on lines 61..64
csfieldguide/static/interactives/mips-simulator/js/mips-simulator.js on lines 81..84
csfieldguide/static/interactives/mips-simulator/js/mips-simulator.js on lines 86..89

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

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

function colour(text, colour) {
    if (SHOWCOLOUR) {
        return '<span style="color:' + colour + '">' + text + '</span>';
    } else {
        return text;
csfieldguide/static/interactives/mips-simulator/js/mips-simulator.js on lines 251..257

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

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