Maingron/MainOS

View on GitHub

Showing 68 of 2,717 total issues

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

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

    sanitizePath: function(path) {
        path = path.replaceAll("//", "/");
        if(path.indexOf("//") >= 0) {
            path = this.sanitizePath(path);
        }
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

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

function refreshTaskList() {
    if(pids.toString() != pidsPrevious.toString()) { // If the task list has changed
        pidsPrevious = pids.slice();

        tasklist.innerHTML = `
Severity: Minor
Found in Program Files/taskmanager/scripts.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 result;
Severity: Major
Found in Program Files/cmd/scripts.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return "";
    Severity: Major
    Found in Program Files/cmd/scripts.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return /*html*/ `
          <b class='helpb' style='font-weight:inherit'><b>cls</b> clears console<br>
          <b>echo <a>[Message]</a></b> well, it's echo...<br>
          <b>run <b>[name of program]</b></b> opens a program<br>
          <b>close <b>[pid of program]</b></b> closes a program<br>
      Severity: Major
      Found in Program Files/cmd/scripts.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return "You have to activate the developer mode to enable js commands. Be careful though!";
        Severity: Major
        Found in Program Files/cmd/scripts.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return result;
          Severity: Major
          Found in system/iofsv2.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return "#iofs:C:/system/icons/unknown_file.svg";
            Severity: Major
            Found in Program Files/Explorer/inner/modules/load_icons.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return "Error: Folder already exists";
              Severity: Major
              Found in Program Files/cmd/scripts.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return "Created folder";
                Severity: Major
                Found in Program Files/cmd/scripts.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return "'(Ancient variable, use settings menu) <br>' + Error: Setting not found";
                  Severity: Major
                  Found in Program Files/cmd/scripts.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return "'(Ancient variable, use settings menu) <br>' + changed setting - a reload may be required";
                    Severity: Major
                    Found in Program Files/cmd/scripts.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return ("(Ancient variable, use settings menu) <br>" + which + ": " + iofs.load(system.user.paths.userPath + "settings/" + which.split(" ")[0] + ".txt"));
                      Severity: Major
                      Found in Program Files/cmd/scripts.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return "Ran JS Command";
                        Severity: Major
                        Found in Program Files/cmd/scripts.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return(`${system.osDetails.name} Version: ${system.osDetails.version}`);
                          Severity: Major
                          Found in Program Files/cmd/scripts.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return "";
                            Severity: Major
                            Found in Program Files/cmd/scripts.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return "<b style='color:#f55; font-weight:inherit'>Command not found. Try /mc:help to get help.</b>";
                              Severity: Major
                              Found in Program Files/cmd/scripts.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return JSON.parse(iofs.load(path)).icon;
                                Severity: Major
                                Found in Program Files/Explorer/inner/modules/load_icons.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return "";
                                  Severity: Major
                                  Found in Program Files/cmd/scripts.js - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language