fnando/babel-schmooze-sprockets

View on GitHub
app/assets/javascripts/babel/external-helpers.js

Summary

Maintainability
D
2 days
Test Coverage

File external-helpers.js has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var babelHelpers = {};
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  return typeof obj;
} : function (obj) {
  return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
Severity: Minor
Found in app/assets/javascripts/babel/external-helpers.js - About 3 hrs to fix

    Function jsx has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    babelHelpers.jsx = function () {
      var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
      return function createRawReactElement(type, props, key, children) {
        var defaultProps = type && type.defaultProps;
        var childrenLength = arguments.length - 3;
    Severity: Minor
    Found in app/assets/javascripts/babel/external-helpers.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 jsx has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    babelHelpers.jsx = function () {
      var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
      return function createRawReactElement(type, props, key, children) {
        var defaultProps = type && type.defaultProps;
        var childrenLength = arguments.length - 3;
    Severity: Minor
    Found in app/assets/javascripts/babel/external-helpers.js - About 1 hr to fix

      Function slicedToArray has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      babelHelpers.slicedToArray = function () {
        function sliceIterator(arr, i) {
          var _arr = [];
          var _n = true;
          var _d = false;
      Severity: Minor
      Found in app/assets/javascripts/babel/external-helpers.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 interopRequireWildcard has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      babelHelpers.interopRequireWildcard = function (obj) {
        if (obj && obj.__esModule) {
          return obj;
        } else {
          var newObj = {};
      Severity: Minor
      Found in app/assets/javascripts/babel/external-helpers.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 createRawReactElement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        return function createRawReactElement(type, props, key, children) {
          var defaultProps = type && type.defaultProps;
          var childrenLength = arguments.length - 3;
      
          if (!props && childrenLength !== 0) {
      Severity: Minor
      Found in app/assets/javascripts/babel/external-helpers.js - About 1 hr to fix

        Function slicedToArray has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        babelHelpers.slicedToArray = function () {
          function sliceIterator(arr, i) {
            var _arr = [];
            var _n = true;
            var _d = false;
        Severity: Minor
        Found in app/assets/javascripts/babel/external-helpers.js - About 1 hr to fix

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

          babelHelpers.get = function get(object, property, receiver) {
            if (object === null) object = Function.prototype;
            var desc = Object.getOwnPropertyDescriptor(object, property);
          
            if (desc === undefined) {
          Severity: Minor
          Found in app/assets/javascripts/babel/external-helpers.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 set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          babelHelpers.set = function set(object, property, value, receiver) {
            var desc = Object.getOwnPropertyDescriptor(object, property);
          
            if (desc === undefined) {
              var parent = Object.getPrototypeOf(object);
          Severity: Minor
          Found in app/assets/javascripts/babel/external-helpers.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 slicedToArrayLoose has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          babelHelpers.slicedToArrayLoose = function (arr, i) {
            if (Array.isArray(arr)) {
              return arr;
            } else if (Symbol.iterator in Object(arr)) {
              var _arr = [];
          Severity: Minor
          Found in app/assets/javascripts/babel/external-helpers.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 getter.call(receiver);
          Severity: Major
          Found in app/assets/javascripts/babel/external-helpers.js - About 30 mins to fix

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

            babelHelpers.createClass = function () {
              function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                  var descriptor = props[i];
                  descriptor.enumerable = descriptor.enumerable || false;
            Severity: Minor
            Found in app/assets/javascripts/babel/external-helpers.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 extends has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            babelHelpers.extends = Object.assign || function (target) {
              for (var i = 1; i < arguments.length; i++) {
                var source = arguments[i];
            
                for (var key in source) {
            Severity: Minor
            Found in app/assets/javascripts/babel/external-helpers.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

            There are no issues that match your filters.

            Category
            Status