packages/org-unit-tree/src/OrgUnitTree.component.js
File OrgUnitTree.component.js
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import PropTypes from 'prop-types';
import LinearProgress from '@material-ui/core/LinearProgress';
import StopIcon from '@material-ui/icons/Stop';
Function render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const currentOu = this.props.root;
const hasChildren = this.hasChildren();
const isSelectable = !!this.props.onSelectClick;
const pathRegEx = new RegExp(`/${currentOu.id}$`);
Function renderLabel
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderLabel(
isSelected,
isSelectable,
isInitiallyExpanded,
canBecomeCurrentRoot,
Function renderChild
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderChild(orgUnit, expandedProp) {
if (!this.shouldIncludeOrgUnit(orgUnit)) {
return null;
}
Function orgUnitPathPropValidator
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
propValue,
key,
compName,
location,
propFullName
Function renderLabel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
renderLabel(
isSelected,
isSelectable,
isInitiallyExpanded,
canBecomeCurrentRoot,
- Read upRead up
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"