Maingron/MainOS

View on GitHub

Showing 68 of 2,717 total issues

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

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

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

        Avoid deeply nested control flow statements.
        Open

                    switch (setting.type.split(">")[1]) {
                        case("1"):
                            settingInput = document.createElement("h1");
                            break;
                            case("2"):
        Severity: Major
        Found in Program Files/settings/scripts.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      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 - About 45 mins to fix

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

            function installExtCallback(path, content, attributes, override, recursive, isRaw) {
            Severity: Minor
            Found in system/iofsv2-installos.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if(["A", "B", "C", "D", "E", "F", "0"].includes(a_attribute)) {
                                      addColorDot(newColorDotDiv, a_attribute);
              
                                      if(a_attribute == "0") {
                                          fileElement.classList.add("system_file");
              Severity: Major
              Found in Program Files/Explorer/inner/modules/file_attributes.js - About 45 mins to fix

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

                    save: function(path, content, attributes = false, override = false, recursive = false, isRaw = true) {
                Severity: Minor
                Found in system/iofsv2.js - About 45 mins to fix

                  Function rectangle has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      rectangle: function(x, y, x2, y2, color) {
                  Severity: Minor
                  Found in Program Files/paint/script.js - About 35 mins to fix

                    Function dragWindow has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function dragWindow(which, x, y, offsetX = 0, offsetY = 0) {
                    Severity: Minor
                    Found in functions-programs.js - About 35 mins to fix

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

                      function returnPathForFileIcon(path) {
                          let filename = iofs.getName(path);
                          var fileending = filename.slice(filename.lastIndexOf("."));
                      
                          if(iofs.typeof(path) == "dir") {
                      Severity: Minor
                      Found in Program Files/Explorer/inner/modules/load_icons.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 focusWindow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function focusWindow(which, state) {
                          if(state == false || which == false) {
                              unfocus();
                              return;
                          }
                      Severity: Minor
                      Found in functions-programs.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 getPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          getPath: function(path) {
                              path = this.sanitizePath(path);
                              var goUpCount = 0;
                      
                              let pathArray = path.split("/");
                      Severity: Minor
                      Found in system/iofsv2.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

                      Severity
                      Category
                      Status
                      Source
                      Language