Maingron/MainOS

View on GitHub

Showing 61 of 2,723 total issues

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 "Command not defined";
    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 "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(`${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 "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 "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 "";
                    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 "";
                        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 Program Files/cmd/scripts.js - About 30 mins to fix

                            Function deletefile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function deletefile(path, includeChildren = false) { // Delete a file or folder
                              console.warn("IOFS1: deletefile(", path, includeChildren , ")");
                            
                              // check if file or folder exists, else return error
                              if(!isfile(path) && !isfolder(path)) {
                            Severity: Minor
                            Found in mainos/iofs.js - About 25 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 setAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function setAttribute(path, attribute, value) {
                              console.warn("IOFS1: setAttribute(", path, attribute, value , ")");
                            
                              var myAttributes = getAttributes(path);
                              var myNewAttributes = "";
                            Severity: Minor
                            Found in mainos/iofs.js - About 25 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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                save: function(path, content, attributes = false, override = false, recursive = false) {
                                    path = this.sanitizePath(path);
                            
                                    if(!this.isAllowedPath(path)) {
                                        return false;
                            Severity: Minor
                            Found in system/iofsv2.js - About 25 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 createNotificationIcon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function createNotificationIcon() {
                              if(parent.document.getElementById("taskbarrighticons")) {
                                if(!parent.document.getElementById("notifications")) {
                                  let notificationIconTemp = document.createElement("a");
                                  notificationIconTemp.id = "notifications";
                            Severity: Minor
                            Found in Program Files/notifications/scripts.js - About 25 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 getWindowByMagic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getWindowByMagic(which) {
                                var result;
                                if(result == undefined || result == null || result == "") {
                                    result = getWindowByPid(which);
                                }
                            Severity: Minor
                            Found in functions-programs.js - About 25 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 isfolder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function isfolder(path) {
                              console.warn("IOFS1: isfolder(", path , ")");
                            
                                if(!path.endsWith("/")) { // Add trailing slash if not present
                                    path += "/";
                            Severity: Minor
                            Found in mainos/iofs.js - About 25 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 register has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function register() {
                                if(os?.document.getElementById("taskbar")) {
                                    if(!os.document.getElementById("start")) {
                                        let startButton = document.createElement("button");
                                        startButton.id = "start";
                            Severity: Minor
                            Found in Program Files/Explorer/Start/scripts.js - About 25 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