Maingron/MainOS

View on GitHub

Showing 68 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

      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

        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

        File script.js has 254 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var path = window.parent.attr;
        
        var canvas = document.getElementById("canvas");
        var ctx = canvas.getContext("2d");
        
        
        Severity: Minor
        Found in Program Files/paint/script.js - About 2 hrs to fix

          Function getInfos has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              getInfos(path) {
                  if(!this.isAllowedPath(path)) {
                      return null;
                  }
          
          
          Severity: Minor
          Found in system/iofsv2.js - About 2 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function 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

          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

          Severity
          Category
          Status
          Source
          Language