yoctore/yocto-load-user-scenario

View on GitHub

Showing 7 of 20 total issues

Function isValid has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

var isValid = function (command) {
  // create async process here for validation
  var deferred = Q.defer();

  // get domain name
Severity: Minor
Found in lib/config.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 execute has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var execute = function (items) {
  // create defer process
  var deferred = Q.defer();

  // default internal process for progressive load
Severity: Major
Found in lib/daemon.js - About 3 hrs to fix

    Function internalProcess has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var internalProcess = function (items) {
        // default result
        var report = { title : '', result  : [] };
        // data is not undefined ?
        if (!_.isUndefined(items)) {
    Severity: Major
    Found in lib/daemon.js - About 3 hrs to fix

      Function isValid has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var isValid = function (command) {
        // create async process here for validation
        var deferred = Q.defer();
      
        // get domain name
      Severity: Major
      Found in lib/config.js - About 3 hrs to fix

        Function timeout has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var timeout = setTimeout(function () {
            // remove timeout
            clearTimeout(timeout);
            // checkif configuration file exists and if format is valid
            fs.stat(command.config.scenario, function (error, stats) {
        Severity: Major
        Found in lib/config.js - About 2 hrs to fix

          Function exportReport has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var exportReport = function (report, toFile, filePath, last) {
            // create defere process
            var deferred = Q.defer();
          
            // is not last item ?
          Severity: Major
          Found in lib/report.js - About 2 hrs to fix

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

            var populate = function () {
              // create defer process
              var deferred = Q.defer();
              // has valid value ?
              if (_.has(storeConfig, 'config') && !_.isEmpty(storeConfig.config)) {
            Severity: Minor
            Found in lib/daemon.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

            Severity
            Category
            Status
            Source
            Language