src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx
Function AgendaItemResearchPane
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
Open
const AgendaItemResearchPane = forwardRef((props = { perdet: '', clientData: {}, updateSelection: '', userSelection: [], legCount: 0, readMode: true }, ref) => {
const navTabRef = useRef();
const dispatch = useDispatch();
const { perdet, clientData, userSelections, updateSelection, legCount,
- 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"
Further reading
Consider simplifying this complex logical expression. Open
Open
if (
(!employeeDataLoading && (employeeDataError || !hruId)) ||
(!empProfileLoading && (empProfileError || !hruId))
) {
return errorAlert;
Avoid too many return
statements within this function. Open
Open
return (<RemarksGlossary
remarks={remarks$}
isReadOnly={readMode}
remarkCategories={rmrkCategories$}
userSelections={userSelections}
Avoid too many return
statements within this function. Open
Open
return errorAlert;
Avoid too many return
statements within this function. Open
Open
return <Spinner type="employee-profile-preview" size="small" />;
Avoid too many return
statements within this function. Open
Open
return (
<Worker workerUrl={getAssetPath('/static/js/pdf.worker.js')}>
{url && <Viewer fileUrl={url} />}
</Worker>
);
Avoid too many return
statements within this function. Open
Open
return (<div id="aim-classifications"> {/* needed for css specificity */}
<Classifications {...classificationsProps} />
</div>);
Avoid too many return
statements within this function. Open
Open
return (<FrequentPositions
positions={frequentPositions}
addFrequentPosition={addFrequentPosition}
disabled={((legCount >= 10) || readMode)}
/>);
Avoid too many return
statements within this function. Open
Open
return errorAlert;
Avoid too many return
statements within this function. Open
Open
return errorAlert;
Avoid too many return
statements within this function. Open
Open
return errorAlert;