Emapic/emapic

View on GitHub

Showing 122 of 2,019 total issues

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

module.exports = function(app) {

    // Function for ordering the votes in descending order
    function orderVotesDesc(results) {
        var orderedVotes = {},
Severity: Major
Found in routes/utils_api.js - About 4 days to fix

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

    module.exports = function(sequelize, DataTypes) {
        var Survey = sequelize.define('Survey', {
            id: { type: DataTypes.BIGINT, autoIncrement: true, primaryKey: true },
            title: { type: DataTypes.STRING, allowNull: false },
            description: DataTypes.STRING,
    Severity: Major
    Found in models/survey.js - About 4 days to fix

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

      module.exports = function(app) {
          utils(app);
      
          var oauthConfig = nconf.get('app').oAuth;
      
      
      Severity: Major
      Found in routes/auth/index.js - About 4 days to fix

        Function exports has a Cognitive Complexity of 177 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function(app) {
        
            // Function for ordering the votes in descending order
            function orderVotesDesc(results) {
                var orderedVotes = {},
        Severity: Minor
        Found in routes/utils_api.js - About 3 days 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 exports has 575 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(app) {
        
            function handleInternalError(req, res) {
                return function(err) {
                    logger.error('Internal server error during API request: ' + err.message);
        Severity: Major
        Found in routes/api-engine_routes.js - About 2 days to fix

          File survey.js has 1037 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          var Promise = require('bluebird'),
              nconf = require('nconf'),
              htmlToText = require('html-to-text'),
              linkifyHtml = require('linkifyjs/html'),
              fsp = require('fs-extra'),
          Severity: Major
          Found in models/survey.js - About 2 days to fix

            Function exports has a Cognitive Complexity of 128 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function(app) {
                Utils = {
                    encryptSurveyId: function(id) {
                        return (id) ? bases.toBase(id * surveyIdEncr.factor, surveyIdEncr.base ) : null;
                    },
            Severity: Minor
            Found in utils.js - About 2 days 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 exports has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function(sequelize, DataTypes) {
                var Survey = sequelize.define('Survey', {
                    id: { type: DataTypes.BIGINT, autoIncrement: true, primaryKey: true },
                    title: { type: DataTypes.STRING, allowNull: false },
                    description: DataTypes.STRING,
            Severity: Minor
            Found in models/survey.js - About 2 days 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

            File utils_api.js has 898 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            var Promise = require('bluebird'),
                csv = Promise.promisifyAll(require('fast-csv')),
                moment = require('moment'),
                XLSX = require('excel4node'),
                sequelize = models.sequelize;
            Severity: Major
            Found in routes/utils_api.js - About 2 days to fix

              Function EmapicApp has 401 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var EmapicApp = function() {
              
                  //  Scope.
                  var self = this,
                      serverConfig,
              Severity: Major
              Found in server.js - About 2 days to fix

                File index.js has 826 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                var passport = require('passport'),
                    LocalStrategy = require('passport-local').Strategy,
                    GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
                    FacebookStrategy = require('passport-facebook').Strategy,
                    RememberMeStrategy = require('passport-remember-me').Strategy,
                Severity: Major
                Found in routes/auth/index.js - About 1 day to fix

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

                  module.exports = function(sequelize, DataTypes) {
                      var Question = sequelize.define('Question', {
                          id: { type: DataTypes.BIGINT, autoIncrement: true, primaryKey: true },
                          type: { type: DataTypes.STRING, allowNull: false, defaultValue: 'text' },
                          title: { type: DataTypes.STRING, allowNull: false, defaultValue: '' },
                  Severity: Major
                  Found in models/question.js - About 1 day to fix

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

                    module.exports = function(app) {
                    
                        app.get('/login', function(req, res){
                            if (req.user) {
                                res.redirect('/dashboard');
                    Severity: Major
                    Found in routes/main.js - About 1 day to fix

                      File question.js has 679 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      var fs = require('fs'),
                          path = require('path'),
                          escape = require('escape-html'),
                          Promise = require('bluebird'),
                          linkifyHtml = require('linkifyjs/html'),
                      Severity: Major
                      Found in models/question.js - About 1 day to fix

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

                        module.exports = function(app) {
                            Utils = {
                                encryptSurveyId: function(id) {
                                    return (id) ? bases.toBase(id * surveyIdEncr.factor, surveyIdEncr.base ) : null;
                                },
                        Severity: Major
                        Found in utils.js - About 1 day to fix

                          Function parseAnswersFromPost has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function parseAnswersFromPost(req, questions, oldAnswers) {
                              var answers = [];
                              oldAnswers = oldAnswers || null;
                              for (var i = 1, iLen = questions.length; i<=iLen; i++) {
                                  var question = questions[i-1];
                          Severity: Minor
                          Found in models/question.js - About 1 day 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

                          File api-engine_routes.js has 585 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          var fs = require('fs'),
                              Promise = require('bluebird'),
                              bases = require('bases'),
                              RateLimit = require('express-rate-limit'),
                              logger = require('../utils/logger'),
                          Severity: Major
                          Found in routes/api-engine_routes.js - About 1 day to fix

                            Function initializeServer has 221 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                self.initializeServer = function() {
                            
                                    self.app = express();
                            
                                    utils(self.app);
                            Severity: Major
                            Found in server.js - About 1 day to fix

                              Function EmapicApp has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                              Open

                              var EmapicApp = function() {
                              
                                  //  Scope.
                                  var self = this,
                                      serverConfig,
                              Severity: Minor
                              Found in server.js - About 1 day 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 exports has 179 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              module.exports = function(app) {
                                  FileHelper = {
                              
                                      saveFileFromBuffer: function(buffer, dstPath, fileName, defaultMime) {
                                          var cleanDstPath = dstPath;
                              Severity: Major
                              Found in utils/file_helper.js - About 7 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language