crystal-ball/componentry

View on GitHub
src/utils/create-active-container-component.tsx

Summary

Maintainability
C
1 day
Test Coverage
A
100%

Function createActiveContainer has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

export function createActiveContainer<
  Name extends ComponentName,
  Props extends ActiveContainerBaseProps,
>(displayName: Name, defaultProps: ActiveContainerDefaults = {}): React.FC<Props> {
  function ActiveContainer(props: Props) {
Severity: Minor
Found in src/utils/create-active-container-component.tsx - 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 createActiveContainer has 113 lines of code (exceeds 75 allowed). Consider refactoring.
Open

export function createActiveContainer<
  Name extends ComponentName,
  Props extends ActiveContainerBaseProps,
>(displayName: Name, defaultProps: ActiveContainerDefaults = {}): React.FC<Props> {
  function ActiveContainer(props: Props) {
Severity: Major
Found in src/utils/create-active-container-component.tsx - About 2 hrs to fix

    Function ActiveContainer has 109 lines of code (exceeds 75 allowed). Consider refactoring.
    Open

      function ActiveContainer(props: Props) {
        const {
          // --- Render elements
          children,
    
    
    Severity: Major
    Found in src/utils/create-active-container-component.tsx - About 2 hrs to fix

      There are no issues that match your filters.

      Category
      Status