syntheticore/declaire

View on GitHub

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 = {};
  
Severity: Minor
Found in src/clientDataInterface.js - About 2 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

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) {
Severity: Minor
Found in src/parser.js - About 2 hrs to fix

    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) {
    Severity: Major
    Found in src/serverPublisher.js - About 2 hrs to fix

      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;
      Severity: Major
      Found in src/parser.js - About 2 hrs to fix

        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) {
        Severity: Major
        Found in src/serverDataInterface.js - About 2 hrs to fix

          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');
          Severity: Minor
          Found in src/serverApplication.js - About 2 hrs to fix

            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');
            Severity: Minor
            Found in src/serverApplication.js - About 2 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 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;
            Severity: Major
            Found in src/REST.js - About 2 hrs to fix

              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';
              Severity: Major
              Found in src/parser.js - About 2 hrs to fix

                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;
                
                
                Severity: Major
                Found in src/undoManager.js - About 2 hrs to fix

                  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,
                  Severity: Major
                  Found in src/model.js - About 2 hrs to fix

                    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);
                    Severity: Minor
                    Found in src/clientStore.js - About 2 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 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,
                    Severity: Major
                    Found in src/viewModel.js - About 2 hrs to fix

                      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);
                      Severity: Minor
                      Found in src/evaluator.js - About 2 hrs to fix

                        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
                        Severity: Minor
                        Found in src/REST.js - About 2 hrs to fix

                          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) {
                          Severity: Minor
                          Found in src/clientRouter.js - About 1 hr to fix

                            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
                            Severity: Minor
                            Found in src/evaluator.js - About 1 hr to fix

                              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) {
                              Severity: Minor
                              Found in src/model.js - About 1 hr to fix

                                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;
                                Severity: Minor
                                Found in src/viewModel.js - About 1 hr to fix

                                  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) {
                                  Severity: Minor
                                  Found in src/serverStreamInterface.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language