Showing 70 of 76 total issues
Function ClientDataInterface
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
var ClientDataInterface = function(model) {
var localStore = ClientStore(model.name);
var url = model.url();
var cache = {};
- 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 parser.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
var _ = require('./utils.js');
// Breadth-first walk the tree in reverse order
var inverseBreadth = function(node, cb) {
Function Publisher
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Publisher = function(express, db) {
var clients = [];
// Write data to all connected clients
var distribute = function(data) {
Function parseTemplate
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseTemplate: function(tmpl) {
var self = this;
var lines = tmpl.split('\n');
var lastIndent = 0;
var lineNum = 0;
Function ServerDataInterface
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ServerDataInterface = function(app, model) {
var name = model.name;
var remoteOnly = {_image: 0, _salt: 0, _hash: 0, _username: 0};
var init = function(data) {
File serverApplication.js
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
require('http').globalAgent.maxSockets = Infinity;
var fs = require('fs');
var path = require('path');
var mongo = require('mongodb');
Function ServerApplication
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
var ServerApplication = function(options) {
// Create express app
var expressApp = express();
var environment = expressApp.get('env');
- 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 REST
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
var REST = function(name, express, dataInterface) {
var baseUrl = '/api/' + name;
return {
serveResource: function() {
var self = this;
Function parseTag
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseTag: function(line) {
var self = this;
var m = line.match(/(([\w-#\.]+\s*>\s*)*)([\w-]+)?(#([\w-]+))?((\.[\w-]+)*)(\((.*)\))?(\+)?( (.*))?/);
var multiTags = m[1];
var tag = m[3] || 'div';
Function UndoManager
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
var UndoManager = function(items) {
var milestones = [{}];
var reverseIndex = 0;
var dontRecord = false;
Function Model
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Model = function(dbCollection, reference, constructor) {
var ref = separateMethods(reference);
var model = {
klass: 'Model',
name: dbCollection,
Function LocalStore
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
var LocalStore = function(modelName) {
// Iterate all items in local storage belonging to our model
var all = function(cb) {
for(var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(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"
Further reading
Function ViewModel
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ViewModel = function(name, reference, constructor) {
var model = Model('_view', reference);
return {
klass: 'ViewModel',
name: name,
Function evalExpr
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
var evalExpr = function(scope, expr, node) {
var m;
// Negation
var negate = (expr[0] == '!');
if(negate) expr = expr.slice(1);
Function serveResource
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
serveResource: function() {
var self = this;
console.log("Serving resource " + baseUrl);
// Get all items
Function Router
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Router = function() {
var listeners = {};
var suppressNextPopstate = false;
var scrollTo = function(id) {
Function evalCompoundExpr
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
var evalCompoundExpr = function(scope, expr, node) {
var booleans = ['||', '&&'];
var comparisons = ['==', '!=', '>', '<', '>=', '<='];
var allOps = _.union(booleans, comparisons);
// Separate expression into values and operators
Function save
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
save: function(values) {
var self = this;
return _.promise(function(ok, fail) {
// Detect event object to allow calling from actions
if(values && values.target) {
Function create
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: function(args, elem, cb) {
var inst = model.create();
// Remove persistance related methods
delete inst.save;
Function serialize
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
serialize: function() {
var html = '';
if(!this.topSerialized) {
// Begin tag
if(!this._fragment) {