RackHD/on-taskgraph

View on GitHub

Showing 100 of 247 total issues

Function swaggerSerializer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function swaggerSerializer(injectableSerializer) {
        var Serializer = injector.get(injectableSerializer);

        function serialize(data) {
            var serializer = new Serializer();
Severity: Minor
Found in lib/services/swagger-api-service.js - About 1 hr to fix

    Function initializePipeline has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        TaskScheduler.prototype.initializePipeline = function() {
            /*
             * Before setting up the stream, make sure it is running, otherwise
             * this will create a stream that will never run and immediately complete.
             * This is basically defensive programming to try to prevent accidents where the
    Severity: Minor
    Found in lib/task-scheduler.js - About 1 hr to fix

      Function Runner has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function Runner(configureFile, Logger, uuid, constants,
                      eventsProtocol, lookupService, Errors, events) {
      Severity: Major
      Found in app.js - About 1 hr to fix

        Function convert_raid_to_jbod has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def convert_raid_to_jbod():
            """
            To delete RAID and create JBOD for each physical disk of a virtual disk with RAID
            :rtype : list
            :return: a string includes all the disks to be erased
        Severity: Minor
        Found in data/templates/secure_erase.py - 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 NotificationApiServiceFactory has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            eventsProtocol,
            Logger,
            waterline,
            Errors,
            Promise,
        Severity: Major
        Found in lib/services/notification-api-service.js - About 50 mins to fix

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

          function ServiceGraph(TaskGraph, store, taskGraphProtocol, Constants, Promise, _) {
          Severity: Minor
          Found in lib/service-graph.js - About 45 mins to fix

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

            function loaderFactory(store, taskLibrary, Logger, assert, Promise, _) {
            Severity: Minor
            Found in lib/loader.js - About 45 mins to fix

              Function executeTasks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function executeTasks(data, timeout) {
                  var handleExecResult = function(_task, _done, error, stdout, stderr) {
                      _task.stdout = stdout;
                      _task.stderr = stderr;
                      _task.error = error;
              Severity: Minor
              Found in data/templates/bootstrap.js - About 45 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 leaseExpirationPollerFactory has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  store,
                  Logger,
                  assert,
                  Constants,
                  Rx,
              Severity: Minor
              Found in lib/lease-expiration-poller.js - About 45 mins to fix

                Function taskRunnerFactory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function taskRunnerFactory(
                    Logger,
                    Promise,
                    graphProgressService,
                    Constants,
                Severity: Minor
                Found in lib/task-runner.js - About 45 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 schemaApiServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    configuration,
                    Logger,
                    Promise,
                    _,
                    nodeFs
                Severity: Minor
                Found in lib/services/schema-api-service.js - About 35 mins to fix

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

                  def mark_on_disk(disk_name, log, flag, back_skip, mark_files):
                  Severity: Minor
                  Found in data/templates/secure_erase.py - About 35 mins to fix

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

                        var handleExecResult = function(_task, _done, error, stdout, stderr) {
                    Severity: Minor
                    Found in data/templates/bootstrap.js - About 35 mins to fix

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

                          def __get_hdparm_duration(self, log):
                              """
                              Get hdparm required secure erase time.
                              :param log: a file object of secure erase log
                              :return: required secure erase time indicated by hdparm tool
                      Severity: Minor
                      Found in data/templates/secure_erase.py - 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 taskApiServiceFactory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function taskApiServiceFactory(
                          taskProtocol,
                          waterline,
                          Errors,
                          util,
                      Severity: Minor
                      Found in lib/services/task-api-service.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 __sg_requests_parser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __sg_requests_parser(self, drive):
                              """
                              Secure erase job progress parser for sg_format and sg_sanitize tools.
                              :param drive: drive name
                              :return: a float digital of percentage
                      Severity: Minor
                      Found in data/templates/secure_erase.py - 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 getSataNameStr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function getSataNameStr(sataDrive) {
                          var output = execSync(cmdSataRawInfo + ' /dev/' + sataDrive);
                          /*  output data like below:
                           *  $ sudo hdparm --Istdout /dev/sda
                           *  dev/sda:
                      Severity: Minor
                      Found in data/templates/get_driveid.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 undefined;
                      Severity: Major
                      Found in app.js - About 30 mins to fix

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

                        def get_disk_size(disk_name, log, mark_files):
                            """
                            Get disk size and create empty mark files
                            :param disk_name: disk name that be copied data to.
                            :param log: an opened file object to store stdout and stderr
                        Severity: Minor
                        Found in data/templates/secure_erase.py - 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 mark_on_disk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def mark_on_disk(disk_name, log, flag, back_skip, mark_files):
                            """
                            Copy 512 Bytes random data to specified disk address as a mark.
                            Or to read the marks from disk for verification
                            :param disk_name: disk name that be copied data to.
                        Severity: Minor
                        Found in data/templates/secure_erase.py - 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