Showing 136 of 152 total issues

Function onEdit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            var onEdit = function(err, response) {

                uploadStatus++;

                if (err) {
Severity: Minor
Found in lib/output/uploadExportFiles.js - About 1 hr to fix

    Function exec has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.exec = function(importModelDir) {
    
        'use strict';
    
        return new Promise(function(resolve, reject) {
    Severity: Minor
    Found in lib/input/readProject.js - About 1 hr to fix

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

      exports.validateRegistry = function(registry) {
          'use strict';
      
          return new Promise(function(resolve) {
      
      
      Severity: Minor
      Found in lib/util/validate.js - 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

      Avoid deeply nested control flow statements.
      Open

                          for (fieldName in model.properties) {
                              field = model.properties[fieldName];
                              if (field.smw_drilldown) {
                                  drilldowninfo.push({
                                      name: field.title,
      Severity: Major
      Found in lib/modelToText/transformModel.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (err.message.indexOf('has been created already') > -1) {
                                            log('[D] Skipping existing page.');
                                        } else {
                                            log('[E] mobo could not upload a page.');
                                            console.dir(err);
        Severity: Major
        Found in lib/modules/import.js - About 45 mins to fix

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

          exports.calculateLogStatistics = function() {
          
              var logHistory = semlog.getLogHistory();
              var logStats = {
                  total: logHistory.length,
          Severity: Minor
          Found in lib/util/statistics.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

          Avoid deeply nested control flow statements.
          Open

                              if (model.items) {
                                  modelId = model.items.id;
                              }
          Severity: Major
          Found in lib/modelToText/generateGraph.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                for (var i = 0; i < inspect.form.length; i++) {
            
                                    edge = _.cloneDeep(edgeTemplate);
            
                                    var target = inspect.form[i];
            Severity: Major
            Found in lib/modelToText/generateGraph.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          } else if (template.wikitext) {
              
                              // Ignore "wikitext" properties, since they'll only be rendered on the form edit page
                              if (exports.settings.debug) {
                                  log('[D] Ignoring form-only "wikitext" injection');
              Severity: Major
              Found in lib/modules/importHelper.js - About 45 mins to fix

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

                exports.writeStatistics = function(statistics, directory) {
                
                    // To Logobject / report
                    log(statistics, true);
                
                
                Severity: Minor
                Found in lib/util/statistics.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 exec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                exports.exec = function(settings, obj, name, registry) {
                    'use strict';
                
                    // Do not create abstract or ignored forms
                    if (obj.$abstract || obj.$ignore) {
                Severity: Minor
                Found in lib/modelToText/transformForm.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

                Avoid deeply nested control flow statements.
                Open

                                    if (modelId) {
                                        var edgeId = formPageName + '-' + modelName;
                
                                        // Ignore wikitext attributes, since they are directly written into the form template
                                        if (!exports.edges[edgeId] && !model.wikitext) {
                Severity: Major
                Found in lib/modelToText/generateGraph.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (obj.properties[obj.$remove[k]]) {
                                          delete obj.properties[obj.$remove[k]];
                                      } else {
                                          log('[W] Cannot remove non existent property "' + obj.$remove[k] + '"');
                                      }
                  Severity: Major
                  Found in lib/modelToModel/intermediaryLayer.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (intersection.length > 0) {
                                                log ('[W] ' + id + ': "recommended" and "required" define the same fields: ' + intersection.join(', '));
                                            }
                    Severity: Major
                    Found in lib/util/validate.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (settings.uploadOutlineCountRefs) {
                                              var modelReferences = model.$referenceCounter || 1;
                                              modelStats += ' <span class="label label-warning">' + modelReferences + '</span>';
                                          }
                      Severity: Major
                      Found in lib/modelToText/generateOutline.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        for (var i = 0; i < items.length; i++) {
                                            if (exports.settings.verbose) {
                                                log('[D] Inserting multiple instance template: ' + templateName);
                                            }
                                            newCollection.push(items[i]);
                        Severity: Major
                        Found in lib/modules/importHelper.js - About 45 mins to fix

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

                          exports.validate = function(json, schema, name) {
                              'use strict';
                          
                              var id = json.$path || json.id || name || '(unknown)';
                          
                          
                          Severity: Minor
                          Found in lib/util/validate.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

                          Avoid deeply nested control flow statements.
                          Open

                                              for (var fieldName in model.properties) {
                          
                                                  // TODO: Analyzing fields could happen on a global level, saved then as metadata
                                                  var field = model.properties[fieldName];
                                                  var inspect = field.items || field;
                          Severity: Major
                          Found in lib/modelToText/generateOutline.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if (exports.settings.verbose) {
                                                log('[D] Appending wikitext: ' + obj);
                                            }
                            Severity: Major
                            Found in lib/modules/importHelper.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                              if (info['new'] === '') {
                                                                  change = ' [+]';
                                                              } else if (info.newrevid) {
                                                                  change = ' [C]';
                                                              }
                              Severity: Major
                              Found in lib/modules/import.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language