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 = {},
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,
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;
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 = {},
- Read upRead up
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);
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'),
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;
},
- Read upRead up
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,
- Read upRead up
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;
Function EmapicApp
has 401 lines of code (exceeds 25 allowed). Consider refactoring. Open
var EmapicApp = function() {
// Scope.
var self = this,
serverConfig,
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,
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: '' },
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');
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'),
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;
},
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];
- Read upRead up
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'),
Function initializeServer
has 221 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.initializeServer = function() {
self.app = express();
utils(self.app);
Function EmapicApp
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
var EmapicApp = function() {
// Scope.
var self = this,
serverConfig,
- Read upRead up
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;