tantalim/tantalim-server

View on GitHub

Showing 33 of 59 total issues

Function compile has 203 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function compile(modelDefinition) {
    var ARTIFACT = pageService.ARTIFACT; // Easy alias

    logger.info('Starting model compile', modelDefinition.name);

Severity: Major
Found in app/services/modelCompiler.js - About 1 day to fix

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

    function compile(modelDefinition) {
        var ARTIFACT = pageService.ARTIFACT; // Easy alias
    
        logger.info('Starting model compile', modelDefinition.name);
    
    
    Severity: Minor
    Found in app/services/modelCompiler.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 desktop has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.desktop = function (req, res, appLocals) {
        if (!req.user) {
            res.redirect('/login');
            return;
        }
    Severity: Major
    Found in app/controllers/pageController.js - About 3 hrs to fix

      Function buildSteps has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function buildSteps(modelDefinition, todo) {
              if (_.isEmpty(modelDefinition.steps)) {
                  return;
              }
      
      
      Severity: Major
      Found in app/services/modelCompiler.js - About 2 hrs to fix

        Function start has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var start = function () {
            var app = express();
        
            app.locals = _.extend(app.locals, config.locals || {});
        
        
        Severity: Major
        Found in server.js - About 2 hrs to fix

          Function updateData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function updateData(modelDefinition, row) {
              return new BluebirdPromise(function (resolve, reject) {
                  logger.debug('starting updateData() for ', modelDefinition.name);
          
                  checkConnection();
          Severity: Major
          Found in app/services/modelSaver.js - About 2 hrs to fix

            File modelSaver.js has 259 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            var _ = require('lodash'),
                BluebirdPromise = require('bluebird'),
                knex = require('knex').knex,
            Severity: Minor
            Found in app/services/modelSaver.js - About 2 hrs to fix

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

                  function mapFields(modelDefinition) {
                      if (!modelDefinition.fields) {
                          logger.warn('Model had no fields');
                          return;
                      }
              Severity: Major
              Found in app/services/modelCompiler.js - About 2 hrs to fix

                Function getModelByName has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getModelByName(modelName) {
                    return new BluebirdPromise(function (resolveGetModelByName, rejectGetModelByName) {
                        logger.debug('starting modelService.getModelByName for ', modelName);
                        var names = toWhere(modelName);
                
                
                Severity: Minor
                Found in app/services/db/modelDatabaseService.js - About 2 hrs to fix

                  Function compile has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function compile(menuDefinition) {
                      logger.info('Starting compile', menuDefinition.name);
                  
                      var pageNames = [];
                  
                  
                  Severity: Minor
                  Found in app/services/menuCompiler.js - About 1 hr to fix

                    Function apply has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function apply(filterString, sql, fields) {
                        if (!filterString) {
                            return;
                        }
                    
                    
                    Severity: Minor
                    Found in app/services/filter.js - About 1 hr to fix

                      Function parseAndCompile has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function parseAndCompile(modelDefinition) {
                              logger.info('Running parseAndCompile for ' + modelDefinition.name);
                              //logger.debug(modelDefinition);
                              var todo = [];
                      
                      
                      Severity: Minor
                      Found in app/services/modelCompiler.js - About 1 hr to fix

                        Function queryModelData has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function queryModelData(model) {
                            return new BluebirdPromise(function (resolve, reject) {
                                logger.debug('starting queryModelData');
                                var sql = convertModelToKnexSql(model);
                        
                        
                        Severity: Minor
                        Found in app/services/dataReader.js - About 1 hr to fix

                          Function convertModelToKnexSql has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function convertModelToKnexSql(model) {
                              logger.debug('starting convertModelToKnexSql for ' + model.name);
                              //logger.debug(JSON.stringify(model));
                          
                              if (!knex) {
                          Severity: Minor
                          Found in app/services/dataReader.js - About 1 hr to fix

                            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 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 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 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 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

                                      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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language