syntheticore/declaire

View on GitHub

Showing 76 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              login: function(username, pw) {
                return _.ajax({
                  verb: 'POST',
                  url: '/login',
                  data: {
            Severity: Major
            Found in src/clientAuth.js and 1 other location - About 2 hrs to fix
            src/clientAuth.js on lines 21..33

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 79.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                signup: function(username, pw) {
                  return _.ajax({
                    verb: 'POST',
                    url: '/signup',
                    data: {
              Severity: Major
              Found in src/clientAuth.js and 1 other location - About 2 hrs to fix
              src/clientAuth.js on lines 6..18

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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 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 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
                                Severity
                                Category
                                Status
                                Source
                                Language