packages/org-unit-tree/src/OrgUnitTree.component.js

Summary

Maintainability
D
1 day
Test Coverage

File OrgUnitTree.component.js has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import LinearProgress from '@material-ui/core/LinearProgress';
import StopIcon from '@material-ui/icons/Stop';

Severity: Minor
Found in packages/org-unit-tree/src/OrgUnitTree.component.js - About 5 hrs to fix

    Function render has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render() {
            const currentOu = this.props.root;
            const hasChildren = this.hasChildren();
            const isSelectable = !!this.props.onSelectClick;
            const pathRegEx = new RegExp(`/${currentOu.id}$`);
    Severity: Major
    Found in packages/org-unit-tree/src/OrgUnitTree.component.js - About 2 hrs to fix

      Function renderLabel has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          renderLabel(
              isSelected,
              isSelectable,
              isInitiallyExpanded,
              canBecomeCurrentRoot,
      Severity: Major
      Found in packages/org-unit-tree/src/OrgUnitTree.component.js - About 2 hrs to fix

        Function renderChild has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            renderChild(orgUnit, expandedProp) {
                if (!this.shouldIncludeOrgUnit(orgUnit)) {
                    return null;
                }
        
        
        Severity: Minor
        Found in packages/org-unit-tree/src/OrgUnitTree.component.js - About 1 hr to fix

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

              propValue,
              key,
              compName,
              location,
              propFullName
          Severity: Minor
          Found in packages/org-unit-tree/src/OrgUnitTree.component.js - About 35 mins to fix

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

                renderLabel(
                    isSelected,
                    isSelectable,
                    isInitiallyExpanded,
                    canBecomeCurrentRoot,
            Severity: Minor
            Found in packages/org-unit-tree/src/OrgUnitTree.component.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