Maingron/MainOS

View on GitHub

Showing 2,717 of 2,717 total issues

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

        result = objs.reduce(function(r, o) {
            Object.keys(o).forEach(function(k) {
                r[k] = o[k];
            });
            program = r;
Severity: Major
Found in scripts.js and 1 other location - About 1 hr to fix
scripts.js on lines 72..77

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

Function Taskbar has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function Taskbar() {
    this.htmlElement = document.getElementById("taskbar");
    this.tasklist = document.getElementById("tasklist");
    

Severity: Minor
Found in system/taskbar.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function listdir has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    listdir: function(path, recurseDepth = 0) {
        path = this.sanitizePath(path);
        if(path == "/") {
            path = "";
        }
Severity: Minor
Found in system/iofsv2.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

    save: function(path, content, attributes = false, override = false, recursive = false, isRaw = true) {
        path = this.sanitizePath(path);

        if(!this.isAllowedPath(path)) {
            return false;
Severity: Minor
Found in system/iofsv2.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

        } else if(tool == "circle-o") {
            if(steps[steps.length - 1][5] == "circle-o" && steps[steps.length - 1][0]) {
                render();
                steps.pop();
            }
Severity: Major
Found in Program Files/paint/script.js and 2 other locations - About 1 hr to fix
Program Files/paint/script.js on lines 55..72
Program Files/paint/script.js on lines 60..72

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

        } else if(tool == "circle") {
            if(steps[steps.length - 1][5] == "circle" && steps[steps.length - 1][0]) {
                render();
                steps.pop();
            }
Severity: Major
Found in Program Files/paint/script.js and 2 other locations - About 1 hr to fix
Program Files/paint/script.js on lines 55..72
Program Files/paint/script.js on lines 65..72

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

        } else if(tool == "rect") {
            if(steps[steps.length - 1][5] == "rect" && steps[steps.length - 1][0]) {
                render();
                steps.pop();
            }
Severity: Major
Found in Program Files/paint/script.js and 2 other locations - About 1 hr to fix
Program Files/paint/script.js on lines 60..72
Program Files/paint/script.js on lines 65..72

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

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

    delete: function(path, recursive = false) {
        path = this.sanitizePath(path);

        if(!this.exists(path)) {
            return false;
Severity: Minor
Found in system/iofsv2.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

async function render(event) {
    if(!lastRenderComplete) {
        return false;
    }

Severity: Minor
Found in Program Files/paint/script.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

    load: function(path, raw = 1) {
        if(!this.isAllowedPath(path)) {
            return null;
        }

Severity: Minor
Found in system/iofsv2.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

function explorerdo(path, action = "default") { // Shows directory or does stuff asigned to files / file types
    if(path == "..") { // If want to go up a directory
        path = iofs.getPath(currentPath);

        if(currentPath.slice(-2) == ":/") { // Make sure to be able to display rootdir again
Severity: Minor
Found in Program Files/Explorer/inner/innerexplorer.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function props has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

var props = (function() {
    var _ = {
        tool: 0,
        toolMap: {
            "pen": 1,
Severity: Minor
Found in Program Files/paint/script.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function savefilefromurl has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function savefilefromurl(path, url, override, fileAttributes) {
    openAsyncFiles.push(path);
    reportOpenAsyncFiles();
    var xhr = new XMLHttpRequest();
    xhr.open("GET", url, true);
Severity: Minor
Found in system/iofsv2-installos.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function showDesktop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function showDesktop(state = "toggle") {
    if(state == "toggle") {
        for(let i = 0; i < pid.length; i++) {
            if(pid[i] != "" && pid[i] != undefined) {
                setWindowMinimized(getWindowById(i), true);
Severity: Minor
Found in functions-programs.js - About 55 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 spawnContextMenu has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function spawnContextMenu(content) { // TODO: Make async
    if (document.getElementsByClassName("contextMenu")[0]) {
        document.getElementsByClassName("contextMenu")[0].outerHTML = "";
    }
    var newelement = document.createElement("div");
Severity: Minor
Found in helper.js - About 55 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 copy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    copy: function(source, destination, override = false) {
        if(!this.isAllowedPath(source) || !this.isAllowedPath(destination)) {
            return false;
        }

Severity: Minor
Found in system/iofsv2.js - About 55 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 updatePlayer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function updatePlayer(playerID) {
    var whichplayer = players[playerID];
    var whichberry = berries[playerID];

    if(automa) { // AI
Severity: Minor
Found in Program Files/Dont Tag Me/scripts.js - About 55 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 loadIOfsLink has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

async function loadIOfsLink(element) {
    const validPrefixes = ["iofs:", "#:", "#iofs:"];
    let usedSrcAttribute;
    let link;

Severity: Minor
Found in helper.js - About 55 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 spherebrush has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    spherebrush: function(x, y, x2, y2, color, width, outlineOnly = false) {
Severity: Major
Found in Program Files/paint/script.js - About 50 mins to fix

    Function circle has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        circle: function(x, y, x2, y2, color, width, outlineOnly = false) {
    Severity: Major
    Found in Program Files/paint/script.js - About 50 mins to fix
      Severity
      Category
      Status
      Source
      Language