snowyu/inherits-ex.js

View on GitHub

Showing 32 of 62 total issues

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

function createObjectWith(aClass, aArguments) {
  var args = [aClass];
  if (aArguments)
    args = args.concat(arraySlice.call(aArguments));
  var result = new (Function.prototype.bind.apply(aClass, args));
Severity: Minor
Found in src/createObjectWith.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 createObject has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function createObject(aClass) {
  var result = new (Function.prototype.bind.apply(aClass, arguments));
  if (aClass !== Object && aClass !== Array && aClass !== RegExp) {
    var vPrototype = aClass.prototype;
    if (!vPrototype.hasOwnProperty('Class')) {
Severity: Minor
Found in src/createObject.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 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  grunt.initConfig({
    clean: {
      build: {
        src: ["lib", ".cache", "tests.js.map", "tests.js"]
Severity: Major
Found in Gruntfile.js - About 2 hrs to fix

    Function _getFilterFunc has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function _getFilterFunc(filter){
      if (!filter) {
        filter = function all(name, value){return value};
      } else if (filter === 1) {
        filter = function raiseErrorOnSuper(name, value) {
    Severity: Minor
    Found in src/mixin.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 isInheritedFrom has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function isInheritedFrom(ctor, superCtor, throwError) {
      if (typeof superCtor === 'string') {return isInheritedFromStr(ctor, superCtor, throwError);}
      if (ctor === superCtor) {
        if (throwError)
          throw new Error('Circular inherits found!');
    Severity: Minor
    Found in src/isInheritedFrom.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 isInheritedFromStr has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function isInheritedFromStr(ctor, superStr, throwError) {
      if (ctor.name === superStr) {
        if (throwError)
          throw new Error('Circular inherits found!');
        else
    Severity: Minor
    Found in src/isInheritedFromStr.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 getParentClass has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function getParentClass(ctor) {
      var result;
      if (typeof ctor === 'object' && ctor !== null) {
        ctor = getPrototypeOf(ctor);
        ctor = getOwnPropValue(ctor, 'Class') || ctor.constructor;
    Severity: Minor
    Found in src/getParentClass.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 _inherits has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function _inherits(ctor, superCtor, staticInherit) {
      var v  = getSuperCtor(ctor);
      var mixinCtor = ctor.mixinCtor_;
      if (mixinCtor && v === mixinCtor) {
        ctor = mixinCtor;
    Severity: Minor
    Found in src/inherits.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 createObjectWith has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function createObjectWith(aClass, aArguments) {
      var args = [aClass];
      if (aArguments)
        args = args.concat(arraySlice.call(aArguments));
      var result = new (Function.prototype.bind.apply(aClass, args));
    Severity: Minor
    Found in src/createObjectWith.js - About 1 hr to fix

      Function isInheritedFrom has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function isInheritedFrom(ctor, superCtor, throwError) {
        if (typeof superCtor === 'string') {return isInheritedFromStr(ctor, superCtor, throwError);}
        if (ctor === superCtor) {
          if (throwError)
            throw new Error('Circular inherits found!');
      Severity: Minor
      Found in src/isInheritedFrom.js - About 1 hr to fix

        Function createObject has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createObject(aClass) {
          var result = new (Function.prototype.bind.apply(aClass, arguments));
          if (aClass !== Object && aClass !== Array && aClass !== RegExp) {
            var vPrototype = aClass.prototype;
            if (!vPrototype.hasOwnProperty('Class')) {
        Severity: Minor
        Found in src/createObject.js - About 1 hr to fix

          Function isInheritedFromStr has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function isInheritedFromStr(ctor, superStr, throwError) {
            if (ctor.name === superStr) {
              if (throwError)
                throw new Error('Circular inherits found!');
              else
          Severity: Minor
          Found in src/isInheritedFromStr.js - About 1 hr to fix

            Function defineProperty has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function defineProperty(object, key, value, aOptions) {
              var descriptor, isAccessor, writable;
              writable = true;
              descriptor = {
                configurable: true,
            Severity: Minor
            Found in src/defineProperty.js - About 1 hr to fix

              Function newPrototype has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function newPrototype(aClass, aConstructor) {
                //Object.create(prototype) only for ES5
                //Object.create(prototype, initProps) only for ES6
                //For Browser not support ES5/6:
                //  var Object = function() { this.constructor = aConstructor; };
              Severity: Minor
              Found in src/newPrototype.js - About 1 hr to fix

                Function getClass has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getClass(aClassName, aScope, aValues) {
                  var vKeys;
                  if (typeof aScope === 'function') {
                    return aScope(aClassName)
                  } else if (isArray(aScope)) {
                Severity: Minor
                Found in src/get-class-by-name.js - About 1 hr to fix

                  Function execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  InheritsEx.execute = function(ctor, superCtors, aScope, aValues) {
                    var isStrCtor;
                    var getClass = InheritsEx.getClass;
                    if (isStrCtor = isString(ctor)) {
                      ctor = getClass(ctor, aScope, aValues);
                  Severity: Minor
                  Found in src/inherits-ex.js - About 1 hr to fix

                    Function _getFilterFunc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function _getFilterFunc(filter){
                      if (!filter) {
                        filter = function all(name, value){return value};
                      } else if (filter === 1) {
                        filter = function raiseErrorOnSuper(name, value) {
                    Severity: Minor
                    Found in src/mixin.js - About 1 hr to fix

                      Function isEmptyFunction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = function isEmptyFunction(aFunc, istanbul) {
                        var vStr = aFunc.toString();
                        var result = /^function\s*\S*\s*\((.|[\n\r\u2028\u2029])*\)\s*{[\s;]*}$/g.test(vStr);
                        if (!result) {result = isEmptyCtor(vStr)}
                      
                      
                      Severity: Minor
                      Found in src/isEmptyFunction.js - About 55 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 createFunction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function createFunction(name, args, body, scope, values) {
                        if (arguments.length === 1) return Function('function ' + name + '(){}\nreturn ' + name + ';')();
                        if (isString(args)) {
                          values = scope;
                          scope = body;
                      Severity: Minor
                      Found in src/createFunction.js - About 55 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 getProtoChain has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function getProtoChain(ctor, depth) {
                        if (depth == null) {
                          depth = 0;
                        }
                        if (depth >= getProtoChain.maxDepth) {
                      Severity: Minor
                      Found in src/getProtoChain.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

                      Severity
                      Category
                      Status
                      Source
                      Language