bnorton/document.js

View on GitHub

Showing 11 of 64 total issues

File index_spec.js has 871 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require('./helpers/spec_helper');

var extend = require('extend');

var Channel = require('../examples/models/channel'),
Severity: Major
Found in spec/index_spec.js - About 2 days to fix

    Function exports has 263 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(klass, options, extras) {
      describe(klass.className, function() {
        var Channel = require('../../examples/models/channel');
        var scope, adapter, channelA, channelB, withRecords = function(done) {
          adapter.create({_id: 123, name: 'Channel A', buffered: 400, list: [20, 40]}, function(r) {
    Severity: Major
    Found in spec/helpers/adapter_helper.js - About 1 day to fix

      File relation_spec.js has 358 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require('./helpers/spec_helper');
      
      describe('Relation', function() {
        var Relation = require('..')().Relation;
        var Channel, relation;
      Severity: Minor
      Found in spec/relation_spec.js - About 4 hrs to fix

        Function set has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          set: function() { var name, from, to, options = arguments[0],
            keyValue = arguments.length == 2, result = {};
        
            if(!arguments[0]) return;
            if(keyValue) { options = {};
        Severity: Minor
        Found in lib/index.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 adapter_helper.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module.exports = function(klass, options, extras) {
          describe(klass.className, function() {
            var Channel = require('../../examples/models/channel');
            var scope, adapter, channelA, channelB, withRecords = function(done) {
              adapter.create({_id: 123, name: 'Channel A', buffered: 400, list: [20, 40]}, function(r) {
        Severity: Minor
        Found in spec/helpers/adapter_helper.js - About 2 hrs to fix

          File index.js has 259 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require('progenitor.js')();
          
          var extend = require('extend'),
            inflect = require('i')(),
            adapterCache = { },
          Severity: Minor
          Found in lib/index.js - About 2 hrs to fix

            Function isValid has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              isValid: function() {
                var i, name, valid = true,
                  validate = this.class.validate || {},
                  presence = validate.presence || [],
                  format = validate.format || {},
            Severity: Minor
            Found in lib/index.js - About 1 hr 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 asJSON has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              asJSON: function() {
                var name, json = {
                  id: this.id.toString(),
                  createdAt: this.get('createdAt'),
                  updatedAt: this.get('updatedAt')
            Severity: Minor
            Found in lib/index.js - About 1 hr 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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              get: function(name) {
                if(name == 'id') return this.id;
            
                if(this.class.belongsTo.indexOf(name) >= 0) {
                  var id = this.get(inflect.foreign_key(name));
            Severity: Minor
            Found in lib/index.js - About 45 mins 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 assignOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function assignOptions(options) {
              var id = options.id || options._id;
            
              this.persisted = false;
            
            
            Severity: Minor
            Found in lib/index.js - About 35 mins 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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                find: function(id) { var model;
                  if(id && (typeof id == 'string' || id._bsontype === 'ObjectID')) {
                    this.loaded = false;
                    id = Document.Adapter.ids.isValid(id) ? Document.Adapter.ids.next(id) : id;
            
            
            Severity: Minor
            Found in lib/index.js - About 25 mins 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

            Severity
            Category
            Status
            Source
            Language