tantalim/tantalim-server

View on GitHub

Showing 33 of 59 total issues

Function getDefinition has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getDefinition(artifactType, artifactName) {
    //console.log('getDefinition %s %s', artifactType, artifactName);
    if (artifactName === undefined) {
        throw Error('Failed to get undefined ' + artifactType);
    }
Severity: Minor
Found in app/services/pageService.js - About 1 hr to fix

    Function getArtifactFromSrc has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getArtifactFromSrc(artifactType, moduleName, artifactName) {
        return new BluebirdPromise(function (resolve, reject) {
            return getRawArtifactFromSrc(artifactType, moduleName, artifactName)
                .then(function(jsonData) {
                    switch (artifactType) {
    Severity: Minor
    Found in app/services/pageService.js - About 1 hr to fix

      Function setup has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var setup = function (custom) {
          var defaultConfig = {
              /**
               * The absolute path to the root of this web server
               */
      Severity: Minor
      Found in server.js - About 1 hr to fix

        Function getArtifactFromCache has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getArtifactFromCache(artifactType, moduleName, artifactName) {
            // TODO Double check variables for injection
            return new BluebirdPromise(function (resolve, reject) {
                var file = getArtifactDirectory() + 'dist/' + artifactType + 's/' + artifactName + '.json';
                logger.debug('reading file from ' + file);
        Severity: Minor
        Found in app/services/pageService.js - About 1 hr to fix

          Function prunePageDefinitionForClient has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.prunePageDefinitionForClient = function (topOriginal) {
              function mapModel(original) {
                  var pruned = {
                      name: original.name,
                      fields: _.map(original.fields, function(field) {
          Severity: Minor
          Found in app/services/pageCompiler.js - About 1 hr to fix

            Function mergeModelIntoPage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function mergeModelIntoPage(modelDefinition, pageDefinition) {
                pageDefinition.model = pageDefinition.model || pageDefinition.name;
                pageDefinition.viewMode = pageDefinition.viewMode || 'form';
            
                mapFields(pageDefinition, modelDefinition.fields);
            Severity: Minor
            Found in app/services/pageCompiler.js - About 1 hr to fix

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

                                      step.join.columns = _.map(join.columns, function (onClause) {
                                          var fromColumn;
                                          if (onClause.from) {
                                              fromColumn = _.find(fromTable.columns, function (column) {
                                                  if (column.name === onClause.from) {
              Severity: Minor
              Found in app/services/modelCompiler.js - About 1 hr to fix

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

                function deleteData(modelDefinition, row) {
                    return new BluebirdPromise(function (resolve, reject) {
                        // Delete my children first
                        childUpdate(modelDefinition, row, true)
                            .then(function () {
                Severity: Minor
                Found in app/services/modelSaver.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if (!fromColumn) {
                                                      throw Error('Failed to find from join column ' + onClause.from +
                                                      ' in table ' + fromTable.name);
                                                  }
                  Severity: Major
                  Found in app/services/modelCompiler.js - About 45 mins to fix

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

                    function apply(filterString, sql, fields) {
                        if (!filterString) {
                            return;
                        }
                    
                    
                    Severity: Minor
                    Found in app/services/filter.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 (column.name === onClause.from) {
                                                            return column;
                                                        }
                    Severity: Major
                    Found in app/services/modelCompiler.js - About 45 mins to fix

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

                      exports.desktop = function (req, res, appLocals) {
                          if (!req.user) {
                              res.redirect('/login');
                              return;
                          }
                      Severity: Minor
                      Found in app/controllers/pageController.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 mergeModelIntoPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function mergeModelIntoPage(modelDefinition, pageDefinition) {
                          pageDefinition.model = pageDefinition.model || pageDefinition.name;
                          pageDefinition.viewMode = pageDefinition.viewMode || 'form';
                      
                          mapFields(pageDefinition, modelDefinition.fields);
                      Severity: Minor
                      Found in app/services/pageCompiler.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