Maingron/MainOS

View on GitHub

Showing 2,717 of 2,717 total issues

File functions-programs.js has 479 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function getProcessList() {
    return(processList);
}

function newProcessListEntry(programIdentifier) {
Severity: Minor
Found in functions-programs.js - About 7 hrs to fix

    Function runcmd has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    function runcmd(which) {
    
      if (which.indexOf("md:") != 1) {
        return "error";
      }
    Severity: Minor
    Found in Program Files/cmd/scripts.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

    File iofsv2.js has 387 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var ismainos = 1;
    
    var iofs = {
        forbiddenCharsInPath: ['*', '?', '#', '$', '\'', '"', '`', '\\', '§', ','],
    
    
    Severity: Minor
    Found in system/iofsv2.js - About 5 hrs to fix

      Function run has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      function run(which, iattr, how) { // Run a program
          let myPid = newProcessListEntry(which);
          let myProgram = system.user.programs[which];
          if(!checkMayStillOpen(which) || myProgram.disabled) {
              processList[myPid] = null;
      Severity: Minor
      Found in functions-programs.js - About 4 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 loadProgramMetadata has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      function loadProgramMetadata(which) { // Load program metadata from program file and handle some other stuff
          if(typeof(which) == "string") {
              which = system.user.programs[which];
          }
      
      
      Severity: Minor
      Found in scripts.js - About 4 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 applyFileAttributesToAll has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      function applyFileAttributesToAll() {
          for(fileElement of document.getElementById("content_files").children) {
              // if file name starts with ., add class hidden
              if(fileElement.innerText.startsWith(".")) {
                  fileElement.classList.add("fattr-hidden");
      Severity: Minor
      Found in Program Files/Explorer/inner/modules/file_attributes.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 applySettingsToCategory has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      function applySettingsToCategory(categoryName) {
          var category = settings.find(category => category.id == categoryName);
          for(setting of category.settings) {
              var settingElement = document.createElement("div");
              settingElement.className = "setting";
      Severity: Minor
      Found in Program Files/settings/scripts.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 random has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function random(min, max, decimals, runs) { // Deprecated
          // Todo: Fix following limits:
          // min has to be at least 0 (no negative possible)
          // limited to digits of Math.random(), other digits will be 0
          // runs only runs Math.random() a defined amount of times before the final result is generated and returned. Instead previous values should be used as some sort of seed to improve randomisation
      Severity: Minor
      Found in helper.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 onload has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      window.onload = function(){
      
      // Check Disk size
      if (localStorage && !localStorage.getItem('size')) {
          let i = 0;
      Severity: Minor
      Found in system/iofsv2-installos.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

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

          } else if(onoff == true) { // Turn on
              which.style.position = "fixed";
              which.style.zIndex = "99999";
              which.style.top = "99999";
              which.style.left = "99999";
      Severity: Major
      Found in functions-programs.js and 1 other location - About 3 hrs to fix
      functions-programs.js on lines 454..468

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

      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(onoff == false) { // Turn off
              which.style.position = "";
              which.style.zIndex = "";
              which.style.top = "";
              which.style.left = "";
      Severity: Major
      Found in functions-programs.js and 1 other location - About 3 hrs to fix
      functions-programs.js on lines 461..468

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

      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

      File scripts.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var objects = {};
      var register = [];
      var program = {};
      var processList = pid = [];
      if(typeof(setting) != "object") {
      Severity: Minor
      Found in scripts.js - About 3 hrs to fix

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

            myWindow.drag.addEventListener("mousedown", function() {
                systemRuntime.clicking = 1;
                focusWindow(getWindowByMagic(myWindow));
                overlayDragBar(this, true);
                this.addEventListener("mouseup", function() {
        Severity: Major
        Found in functions-programs.js and 2 other locations - About 2 hrs to fix
        functions-programs.js on lines 137..145
        functions-programs.js on lines 165..173

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

        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

            myWindow.resizer2.addEventListener("mousedown", function() {
                systemRuntime.clicking = 1;
                focusWindow(getWindowByMagic(myWindow));
                overlayResizer(this, true);
                this.addEventListener("mouseup", function() {
        Severity: Major
        Found in functions-programs.js and 2 other locations - About 2 hrs to fix
        functions-programs.js on lines 127..135
        functions-programs.js on lines 165..173

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

        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

            myWindow.drag.addEventListener("touchstart", function() {
                systemRuntime.clicking = 1;
                focusWindow(getWindowByMagic(myWindow));
                overlayDragBar(this, true);
                this.addEventListener("touchend", function() {
        Severity: Major
        Found in functions-programs.js and 2 other locations - About 2 hrs to fix
        functions-programs.js on lines 127..135
        functions-programs.js on lines 137..145

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

        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(state == true) {
                which.classList.add("maximized");
                which.classList.remove("notmaximized");
                which.style.top = "0";
                which.style.left = "0";
        Severity: Major
        Found in functions-programs.js and 1 other location - About 2 hrs to fix
        functions-programs.js on lines 506..516

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

        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 if(state == false) {
                which.classList.remove("maximized");
                which.classList.add("notmaximized");
                which.style.top = "15%";
                which.style.left = "15%";
        Severity: Major
        Found in functions-programs.js and 1 other location - About 2 hrs to fix
        functions-programs.js on lines 499..516

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

        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 if (element.mozRequestFullScreen) { element.mozRequestFullScreen(); }
                    else if (element.msRequestFullscreen) { element.msRequestFullscreen(); }
                    else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(); }
                    else if (element.requestFullscreen) { element.requestFullscreen(); }
        Severity: Major
        Found in scripts.js and 1 other location - About 2 hrs to fix
        scripts.js on lines 385..388

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 87.

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

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

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

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

        Refactorings

        Further Reading

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

                    if (document.exitFullscreen) { document.exitFullscreen(); }
                    else if (document.msExitFullscreen) { document.msExitFullscreen(); }
                    else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
                    else if (document.exitFullscreen) { document.exitFullscreen(); }
        Severity: Major
        Found in scripts.js and 1 other location - About 2 hrs to fix
        scripts.js on lines 380..383

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 87.

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

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

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

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

        Refactorings

        Further Reading

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

        async function doThisOnMouseMove(e) {
            let boundingClientRect = canvas.getBoundingClientRect()
            ctx.mouseX = +((e.clientX - boundingClientRect.left) * (canvas.width / boundingClientRect.width)).toFixed(0);
            ctx.mouseY = +((e.clientY - boundingClientRect.top) * (canvas.height / boundingClientRect.height)).toFixed(0);
        
        
        Severity: Minor
        Found in Program Files/paint/script.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

        Severity
        Category
        Status
        Source
        Language