tantalim/tantalim-server

View on GitHub

Showing 59 of 59 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                    fields: function (done) {
                        dao.getFieldsByModelID(model.data.modelID).then(function (data) {
                            done(null, data);
                        }, function (err) {
                            done(err, null);
Severity: Major
Found in app/services/db/modelDatabaseService.js and 2 other locations - About 1 hr to fix
app/services/db/modelDatabaseService.js on lines 103..109
app/services/db/modelDatabaseService.js on lines 110..116

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                    children: function (done) {
                        dao.getChildJoinsByModelID(model.data.modelID).then(function (data) {
                            done(null, data);
                        }, function (err) {
                            done(err, null);
Severity: Major
Found in app/services/db/modelDatabaseService.js and 2 other locations - About 1 hr to fix
app/services/db/modelDatabaseService.js on lines 96..102
app/services/db/modelDatabaseService.js on lines 103..109

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                    steps: function (done) {
                        dao.getStepsByModelID(model.data.modelID).then(function (data) {
                            done(null, data);
                        }, function (err) {
                            done(err, null);
Severity: Major
Found in app/services/db/modelDatabaseService.js and 2 other locations - About 1 hr to fix
app/services/db/modelDatabaseService.js on lines 96..102
app/services/db/modelDatabaseService.js on lines 110..116

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function childUpdate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function childUpdate(modelDefinition, row, forceDelete) {
    return new BluebirdPromise(function (resolve, reject) {
        logger.debug('starting childUpdate() for ', modelDefinition.name);

        if (!modelDefinition.children) {
Severity: Minor
Found in app/services/modelSaver.js - About 1 hr to fix

    Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (grunt) {
        // Project Configuration
        grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
            watch: {
    Severity: Minor
    Found in gruntfile.js - About 1 hr to fix

      Function insertData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function insertData(modelDefinition, row) {
          return new BluebirdPromise(function (resolve, reject) {
              logger.debug('starting insertData() for ', modelDefinition.name);
              //console.log(row);
      
      
      Severity: Minor
      Found in app/services/modelSaver.js - About 1 hr to fix

        Function mapFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function mapFields(pageDefinition, modelFields) {
            pageDefinition.hasFormView = false;
            pageDefinition.hasTableView = false;
            pageDefinition.hasNavigation = false;
        
        
        Severity: Minor
        Found in app/services/pageCompiler.js - About 1 hr to fix

          Function addLogins has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function addLogins(app) {
              app.get('/logout', function (req, res) {
                  req.logout();
                  res.redirect('/');
              });
          Severity: Minor
          Found in app/routes/index.js - About 1 hr to fix

            Function getSqlReadyRow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    var sqlReadyRow = (function getSqlReadyRow() {
                        function included(field) {
                            function isDefinedAndFalse(value) {
                                if (value === undefined) {
                                    return false;
            Severity: Minor
            Found in app/services/modelSaver.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                                  if (join.table in tables) {
                                      var toTable = tables[join.table];
                                      step.join = {
                                          name: step.join,
                                          table: {
              Severity: Major
              Found in app/services/modelCompiler.js and 1 other location - About 1 hr to fix
              app/services/modelCompiler.js on lines 179..190

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if (modelDefinition.basisTable in tables) {
                              var tableDefinition = tables[modelDefinition.basisTable];
                              modelDefinition.basisTable = {
                                  name: tableDefinition.name,
                                  dbName: tableDefinition.dbName
              Severity: Major
              Found in app/services/modelCompiler.js and 1 other location - About 1 hr to fix
              app/services/modelCompiler.js on lines 114..160

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                  app.get('/', function (req, res) {
                                      req.pageName = 'Home'; // TODO get this 'Home' from the menu default
                                      pageController.desktop(req, res, app.locals);
                                  });
                              Severity: Minor
                              Found in app/routes/index.js and 1 other location - About 50 mins to fix
                              app/routes/index.js on lines 11..14

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 51.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Severity
                              Category
                              Status
                              Source
                              Language