snowyu/inherits-ex.js

View on GitHub

Showing 32 of 62 total issues

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

function cloneCtor(dest, src, filter) {
  var filterFn = function (name, value) {
    for (var n of [ 'length', 'name', 'arguments', 'caller', 'prototype' ]) {
      if (n === name) {
        value = undefined;
Severity: Minor
Found in src/mixin.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 setScope has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

InheritsEx.setScope = function(aScope) {
  if (Array.isArray(aScope)) {
    for (var j = 0; j < aScope.length; j++) {
      var k = aScope[j];
      var vName = k.name;
Severity: Minor
Found in src/inherits-ex.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 mixin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function mixin(ctor, superCtor, options) {
  var v  = getSuperCtor(ctor); // original superCtor
  var result = false;
  // Check if the two classes are already related in some way to avoid circular or duplicate inheritance
  if (!isMixinedFrom(ctor, superCtor) && !isInheritedFrom(ctor, superCtor) && !isInheritedFrom(superCtor, ctor)) {
Severity: Minor
Found in src/mixin.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 defineProperty has a Cognitive Complexity of 8 (exceeds 5 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 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 clonePrototype has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function clonePrototype(dest, src, filter) {
  // filter = _getFilterFunc(filter);
  var filterFn = function (name, value) {
    for (var n of [ 'Class', 'constructor' ]) {
      if (n === name) {
Severity: Minor
Found in src/mixin.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 createFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function createFunction(name, args, body, scope, values) {
Severity: Minor
Found in src/createFunction.js - About 35 mins to fix

    Function getClassByName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function getClassByName(aClassName, aScope, aValues) {
      var result;
      if (aClassName != null) {
        if (typeof aClassName === 'function') {
          result = aClassName;
    Severity: Minor
    Found in src/get-class-by-name.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 getSuper has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function getSuper(instance, cache) {
      if (typeof instance !== 'object' || instance === null) {
        throw new TypeError('getSuper() can only be used with instances of an object');
      }
      if (cache === true) cache = gCache
    Severity: Minor
    Found in src/getSuper.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

    Avoid too many return statements within this function.
    Open

        return false;
    Severity: Major
    Found in src/isNativeReflectConstruct.js - About 30 mins to fix

      Function getClass has a Cognitive Complexity of 6 (exceeds 5 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 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

      Function isMixinedFromStr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function isMixinedFromStr(ctor, superStr) {
        var result = false;
        var mixinCtors = ctor.mixinCtors_;
        if (mixinCtors) {
          for (var i = 0; i < mixinCtors.length; i++) {
      Severity: Minor
      Found in src/isMixinedFromStr.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

      Function getCtorOfOwnProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function getCtorOfOwnProperty(aClass, aPropertyName) {
        var result;
        var vPrototype = aClass.prototype;
      
        while (vPrototype && !vPrototype.hasOwnProperty(aPropertyName)) {
      Severity: Minor
      Found in src/getCtorOfProperty.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