MetaPhase-Consulting/State-TalentMAP

View on GitHub
src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx

Summary

Maintainability
C
1 day
Test Coverage
F
58%

Function AgendaItemResearchPane has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
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,

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

        if (
          (!employeeDataLoading && (employeeDataError || !hruId)) ||
          (!empProfileLoading && (empProfileError || !hruId))
        ) {
          return errorAlert;
Severity: Major
Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 40 mins to fix

    Avoid too many return statements within this function.
    Open

            return (<RemarksGlossary
              remarks={remarks$}
              isReadOnly={readMode}
              remarkCategories={rmrkCategories$}
              userSelections={userSelections}
    Severity: Major
    Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                return errorAlert;
      Severity: Major
      Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return <Spinner type="employee-profile-preview" size="small" />;
        Severity: Major
        Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return (
                    <Worker workerUrl={getAssetPath('/static/js/pdf.worker.js')}>
                      {url && <Viewer fileUrl={url} />}
                    </Worker>
                  );
          Severity: Major
          Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return (<div id="aim-classifications"> {/* needed for css specificity */}
                      <Classifications {...classificationsProps} />
                    </div>);
            Severity: Major
            Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return (<FrequentPositions
                        positions={frequentPositions}
                        addFrequentPosition={addFrequentPosition}
                        disabled={((legCount >= 10) || readMode)}
                      />);
              Severity: Major
              Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return errorAlert;
                Severity: Major
                Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return errorAlert;
                  Severity: Major
                  Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return errorAlert;
                    Severity: Major
                    Found in src/Components/Agenda/AgendaItemResearchPane/AgendaItemResearchPane.jsx - About 30 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status