oliversalzburg/sanitizr

View on GitHub

Showing 17 of 23 total issues

Function TypeHelper$conceal has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

TypeHelper.prototype.conceal = function TypeHelper$conceal( instance, userClass, clone, concealWith ) {
    if( !instance ) {
        return instance;
    }
    userClass = "undefined" === typeof userClass ? TypeInfo.USERCLASS_USER : userClass;
Severity: Minor
Found in lib/type/helper.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 TypeHelper$omitHidden has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

TypeHelper.prototype.omitHidden = function TypeHelper$omitHidden( instance, userClass, clone ) {
    if( !instance ) {
        return instance;
    }
    userClass          = "undefined" === typeof userClass ? TypeInfo.USERCLASS_USER : userClass;
Severity: Minor
Found in lib/type/helper.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 TypeHelper$omitReadOnly has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

TypeHelper.prototype.omitReadOnly = function TypeHelper$omitReadOnly( instance, userClass, clone ) {
    if( !instance ) {
        return instance;
    }
    userClass          = "undefined" === typeof userClass ? TypeInfo.USERCLASS_USER : userClass;
Severity: Minor
Found in lib/type/helper.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 exports has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function( grunt ) {

    // Project configuration.
    grunt.initConfig(
        {
Severity: Major
Found in Gruntfile.js - About 2 hrs to fix

    Function TypeHelper$conceal has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    TypeHelper.prototype.conceal = function TypeHelper$conceal( instance, userClass, clone, concealWith ) {
        if( !instance ) {
            return instance;
        }
        userClass = "undefined" === typeof userClass ? TypeInfo.USERCLASS_USER : userClass;
    Severity: Minor
    Found in lib/type/helper.js - About 1 hr to fix

      Function TypeHelper$omitHidden has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      TypeHelper.prototype.omitHidden = function TypeHelper$omitHidden( instance, userClass, clone ) {
          if( !instance ) {
              return instance;
          }
          userClass          = "undefined" === typeof userClass ? TypeInfo.USERCLASS_USER : userClass;
      Severity: Minor
      Found in lib/type/helper.js - About 1 hr to fix

        Function TypeHelper$omitReadOnly has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        TypeHelper.prototype.omitReadOnly = function TypeHelper$omitReadOnly( instance, userClass, clone ) {
            if( !instance ) {
                return instance;
            }
            userClass          = "undefined" === typeof userClass ? TypeInfo.USERCLASS_USER : userClass;
        Severity: Minor
        Found in lib/type/helper.js - About 1 hr to fix

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

          TypeHelper.prototype.omitNull = function TypeHelper$omitNull( instance, clone ) {
              if( !instance ) {
                  return instance;
              }
              var targetInstance = clone ? _.clone( instance ) : instance;
          Severity: Minor
          Found in lib/type/helper.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 assemble has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function assemble( typeName, collectionName, typeDescription ) {
              // Only import mongoose if this module is actually used.
              var mongoose = require( "mongoose" );
              var Schema   = mongoose.Schema;
          
          
          Severity: Minor
          Found in lib/type/factory.js - About 1 hr to fix

            Function TypeHelper$reduceComplex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            TypeHelper.prototype.reduceComplex = function TypeHelper$reduceComplex( instance, clone ) {
                if( !instance ) {
                    return instance;
                }
                var targetInstance = clone ? _.clone( instance ) : instance;
            Severity: Minor
            Found in lib/type/helper.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 internalDecorate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function internalDecorate( typeDescription, propertyName, userClass, attribute ) {
                if( propertyName && Array.isArray( typeDescription[ propertyName ] ) ) {
                    internalDecorate( typeDescription[ propertyName ], 0, userClass, attribute );
                    return;
                }
            Severity: Minor
            Found in lib/type/decorator.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 TypeHelper$omitNull has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            TypeHelper.prototype.omitNull = function TypeHelper$omitNull( instance, clone ) {
                if( !instance ) {
                    return instance;
                }
                var targetInstance = clone ? _.clone( instance ) : instance;
            Severity: Minor
            Found in lib/type/helper.js - About 1 hr to fix

              Function TypeDecorator$decorateComposite has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              TypeDecorator.prototype.decorateComposite = function TypeDecorator$decorateComposite( compositeName, userClass, attribute ) {
                  // Refuse to decorate existing properties on the type, unless it's a composite
                  if( this.typeDescription[ compositeName ] ) {
                      if( !this.typeDescription.__COMPOSITES__ ||
                          ( this.typeDescription.__COMPOSITES__ && -1 === this.typeDescription.__COMPOSITES__.indexOf( compositeName ) ) ) {
              Severity: Minor
              Found in lib/type/decorator.js - About 1 hr to fix

                Function TypeHelper$reduceComplex has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                TypeHelper.prototype.reduceComplex = function TypeHelper$reduceComplex( instance, clone ) {
                    if( !instance ) {
                        return instance;
                    }
                    var targetInstance = clone ? _.clone( instance ) : instance;
                Severity: Minor
                Found in lib/type/helper.js - About 1 hr to fix

                  Function TypeDecorator$decorateComposite has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  TypeDecorator.prototype.decorateComposite = function TypeDecorator$decorateComposite( compositeName, userClass, attribute ) {
                      // Refuse to decorate existing properties on the type, unless it's a composite
                      if( this.typeDescription[ compositeName ] ) {
                          if( !this.typeDescription.__COMPOSITES__ ||
                              ( this.typeDescription.__COMPOSITES__ && -1 === this.typeDescription.__COMPOSITES__.indexOf( compositeName ) ) ) {
                  Severity: Minor
                  Found in lib/type/decorator.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 TypeInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function TypeInfo( typeName, typeDescription ) {
                      // An identifier that is supposed to uniquely identify the type being described.
                      this.typeName = typeName.toLowerCase();
                  
                      this.typeDescription = typeDescription;
                  Severity: Minor
                  Found in lib/type/info.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

                  Avoid too many return statements within this function.
                  Open

                      return null;
                  Severity: Major
                  Found in lib/type/info.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language