rofrischmann/fela

View on GitHub
packages/fela-bindings/src/createComponentFactory.js

Summary

Maintainability
F
3 days
Test Coverage

Function createComponentFactory has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

export default function createComponentFactory(
  createElement,
  RendererContext,
  FelaTheme,
  withProxy = false,
Severity: Minor
Found in packages/fela-bindings/src/createComponentFactory.js - About 1 day 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 createComponentFactory has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function createComponentFactory(
  createElement,
  RendererContext,
  FelaTheme,
  withProxy = false,
Severity: Major
Found in packages/fela-bindings/src/createComponentFactory.js - About 4 hrs to fix

    Function createComponent has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      return function createComponent(rule, type = 'div', passThroughProps = []) {
        const displayName = rule.name ? rule.name : 'FelaComponent'
    
        const FelaComponent = ({
          children,
    Severity: Major
    Found in packages/fela-bindings/src/createComponentFactory.js - About 4 hrs to fix

      Function renderFn has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              createElement(FelaTheme, undefined, (_felaTheme) => {
                if (!renderer) {
                  throw new Error(
                    "createComponent() can't render styles without the renderer in the context. Missing react-fela's <Provider /> at the app root?"
                  )
      Severity: Major
      Found in packages/fela-bindings/src/createComponentFactory.js - About 3 hrs to fix

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

          createElement,
          RendererContext,
          FelaTheme,
          withProxy = false,
          alwaysPassThroughProps = []
        Severity: Minor
        Found in packages/fela-bindings/src/createComponentFactory.js - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status