HurricaneJames/react-immutable-proptypes

View on GitHub
src/ImmutablePropTypes.js

Summary

Maintainability
C
1 day
Test Coverage

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

function createShapeTypeChecker(shapeTypes, immutableClassName = 'Iterable', immutableClassTypeValidator = Immutable.Iterable.isIterable) {
  function validate(props, propName, componentName, location, propFullName, ...rest) {
    var propValue = props[propName];
    if (!immutableClassTypeValidator(propValue)) {
      var propType = getPropType(propValue);
Severity: Minor
Found in src/ImmutablePropTypes.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 createRecordOfTypeChecker has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function createRecordOfTypeChecker(recordKeys) {
  function validate(props, propName, componentName, location, propFullName, ...rest) {
    var propValue = props[propName];
    if (!(propValue instanceof Immutable.Record)) {
      var propType = getPropType(propValue);
Severity: Minor
Found in src/ImmutablePropTypes.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 createIterableTypeChecker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function createIterableTypeChecker(typeChecker, immutableClassName, immutableClassTypeValidator) {

  function validate(props, propName, componentName, location, propFullName, ...rest) {
    var propValue = props[propName];
    if (!immutableClassTypeValidator(propValue)) {
Severity: Minor
Found in src/ImmutablePropTypes.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 checkType has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function checkType(isRequired, props, propName, componentName, location, propFullName, ...rest) {
Severity: Major
Found in src/ImmutablePropTypes.js - About 50 mins to fix

    Function validate has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function validate(props, propName, componentName, location, propFullName, ...rest) {
    Severity: Minor
    Found in src/ImmutablePropTypes.js - About 45 mins to fix

      Function validate has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        function validate(props, propName, componentName, location, propFullName, ...rest) {
      Severity: Minor
      Found in src/ImmutablePropTypes.js - About 45 mins to fix

        Function validate has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          function validate(props, propName, componentName, location, propFullName, ...rest) {
        Severity: Minor
        Found in src/ImmutablePropTypes.js - About 45 mins to fix

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

          function createChainableTypeChecker(validate) {
            function checkType(isRequired, props, propName, componentName, location, propFullName, ...rest) {
              propFullName = propFullName || propName;
              componentName = componentName || ANONYMOUS;
              if (props[propName] == null) {
          Severity: Minor
          Found in src/ImmutablePropTypes.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 validate has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            function validate(props, propName, componentName, location, propFullName, ...rest) {
          Severity: Minor
          Found in src/ImmutablePropTypes.js - About 45 mins to fix

            Function validate has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              function validate(props, propName, componentName, location, propFullName) {
            Severity: Minor
            Found in src/ImmutablePropTypes.js - About 35 mins to fix

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

              function createKeysTypeChecker(typeChecker) {
              
                function validate(props, propName, componentName, location, propFullName, ...rest) {
                  var propValue = props[propName];
                  if (typeof typeChecker !== 'function') {
              Severity: Minor
              Found in src/ImmutablePropTypes.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

              There are no issues that match your filters.

              Category
              Status