archangel-irk/storage

View on GitHub

Showing 146 of 197 total issues

File document.js has 1062 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/*!
 * Module dependencies.
 */
Severity: Major
Found in lib/document.js - About 2 days to fix

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

    exports.set = function (path, val, o, special, map, _copying) {
      var lookup;
    
      if ('function' === typeof special) {
        if (special.length < 2) {
    Severity: Minor
    Found in lib/mpath.js - About 1 day 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 set has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

    Document.prototype.set = function (path, val, type, options) {
      if (type && 'Object' === utils.getFunctionName(type.constructor)) {
        options = type;
        type = undefined;
      }
    Severity: Minor
    Found in lib/document.js - About 1 day 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 exports has 193 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (grunt) {
      var webpack = require('webpack');
      require('time-grunt')(grunt);
    
      var webpack_karma = {
    Severity: Major
    Found in Gruntfile.js - About 7 hrs to fix

      Function $toObject has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

      Document.prototype.$toObject = function(options, json) {
        var defaultOptions = { transform: true, json: json };
      
        if (options && options.depopulate && !options._skipDepopulateTopLevel && this.$__.wasPopulated) {
          // populated paths that we set to a document
      Severity: Minor
      Found in lib/document.js - About 6 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 parse has 143 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function parse (docs) {
        docs.split(/^### /gm).forEach(function (chunk) {
          if (!(chunk = chunk.trim())) return;
      
          chunk = chunk.split(/^([^\n]+)\n/);
      Severity: Major
      Found in docs/source/api.js - About 5 hrs to fix

        Function set has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Document.prototype.set = function (path, val, type, options) {
          if (type && 'Object' === utils.getFunctionName(type.constructor)) {
            options = type;
            type = undefined;
          }
        Severity: Major
        Found in lib/document.js - About 5 hrs to fix

          File schema.js has 375 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          /*!
           * Module dependencies.
           */
          Severity: Minor
          Found in lib/schema.js - About 5 hrs to fix

            Function Document has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

            function Document ( data, collectionName, schema, fields, init ){
              if ( !(this instanceof Document) ) {
                return new Document( data, collectionName, schema, fields, init );
              }
            
            
            Severity: Minor
            Found in lib/document.js - About 4 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 cast has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

            DocumentArray.prototype.cast = function (value, doc, init, prev) {
              var selected
                , subdoc
                , i;
            
            
            Severity: Minor
            Found in lib/schema/documentarray.js - About 4 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 init has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            function init (self, obj, doc, prefix) {
              prefix = prefix || '';
            
              var keys = Object.keys(obj)
                , len = keys.length
            Severity: Minor
            Found in lib/document.js - About 3 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 Document has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Document ( data, collectionName, schema, fields, init ){
              if ( !(this instanceof Document) ) {
                return new Document( data, collectionName, schema, fields, init );
              }
            
            
            Severity: Major
            Found in lib/document.js - About 3 hrs to fix

              Function write has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

              Binary.prototype.write = function write(string, offset) {
                offset = typeof offset === 'number' ? offset : this.position;
              
                // If the buffer is to small let's extend the buffer
                if(this.buffer.length < offset + string.length) {
              Severity: Minor
              Found in lib/binary.js - About 3 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 set has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.set = function (path, val, o, special, map, _copying) {
                var lookup;
              
                if ('function' === typeof special) {
                  if (special.length < 2) {
              Severity: Major
              Found in lib/mpath.js - About 3 hrs to fix

                Function isSelected has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                Document.prototype.isSelected = function isSelected (path) {
                  if (this.$__.selected) {
                
                    if ('_id' === path) {
                      return 0 !== this.$__.selected._id;
                Severity: Minor
                Found in lib/document.js - About 3 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 cast has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                ObjectId.prototype.cast = function ( value, doc, init, priorVal ) {
                  // lazy load
                  Document || (Document = require('./../document'));
                
                  if ( SchemaType._isRef( this, value ) ) {
                Severity: Minor
                Found in lib/schema/objectid.js - About 3 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 exports has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function (config) {
                  'use strict';
                
                  config.set({
                    // list of files / patterns to load in the browser
                Severity: Major
                Found in karma.conf.js - About 3 hrs to fix

                  Function cast has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  SchemaBuffer.prototype.cast = function (value, doc, init) {
                    var ret;
                  
                    if (SchemaType._isRef(this, value, doc, init)) {
                      // wait! we may need to cast this to a document
                  Severity: Minor
                  Found in lib/schema/buffer.js - About 3 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 deferred.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  'use strict';
                  
                  /*
                  Standalone Deferred
                  Copyright 2012 Otto Vehviläinen
                  Severity: Minor
                  Found in lib/deferred.js - About 3 hrs to fix

                    Function value has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Binary.prototype.value = function value(asRaw) {
                      asRaw = asRaw == null ? false : asRaw;
                    
                      // Optimize to serialize for the situation where the data == size of buffer
                      if(asRaw && typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position)
                    Severity: Minor
                    Found in lib/binary.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

                    Severity
                    Category
                    Status
                    Source
                    Language