Showing 58 of 608 total issues
Function controller
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: function($uibModalInstance, $scope) {
/*
** startPage Button Methods
*/
Function controller
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: function($uibModalInstance, $scope) {
/*
** startPage Button Methods
*/
Function timestamp
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function timestamp (schema, options) {
options || (options = {})
// Options
var fields = {}
Function formByIDFast
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.formByIDFast = function(req, res, next, id) {
if (!mongoose.Types.ObjectId.isValid(id)) {
return res.status(400).send({
message: 'Form is invalid'
});
Function saveVisitorData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var saveVisitorData = function (data, socket, cb){
Form.findById(data.formId, function(err, form) {
if (err) {
console.error(err);
throw new Error(errorHandler.getErrorMessage(err));
Function addMenuItem
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuItemType, menuItemUIRoute, isPublic, roles, position) {
Function addSubMenuItem
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles, position) {
Function timestamp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function timestamp (schema, options) {
options || (options = {})
// Options
var fields = {}
- 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
Avoid deeply nested control flow statements. Open
if (passwordDetails.newPassword === passwordDetails.verifyPassword) {
user.password = passwordDetails.newPassword;
user.save(function(err) {
if (err) {
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (app, db) {
var server = http.createServer(app);
var io;
// make it possible to only expose one domain
- 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 read
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.read = function(req, res) {
if(!req.user || (req.form.admin.id !== req.user.id) ){
readForRender(req, res);
} else {
var newForm = req.form.toJSON();
- 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 update
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$scope.update = $rootScope.update = function(updateImmediately, data, shouldDiff, refreshAfterUpdate, cb){
Function update
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
scope.update = function(updateImmediately, data, isDiffed, refreshAfterUpdate, cb){
Function checkLoggedin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var checkLoggedin = function($q, $timeout, $state, User, Auth) {
Function exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(db) {
// Initialize express app
var app = express();
var url = require('url');
- 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
Avoid too many return
statements within this function. Open
return next();
Avoid too many return
statements within this function. Open
return next();
Function getDeletedIndexes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getDeletedIndexes(needle, haystack){
var deletedIndexes = [];
if(haystack.length > 0){
for(var i = 0; i < needle.length; i++){
- 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"