MetaPhase-Consulting/State-TalentMAP

View on GitHub
src/Components/AdministratorPage/OrgStats/OrgStats.jsx

Summary

Maintainability
A
3 hrs
Test Coverage
F
4%

Consider simplifying this complex logical expression.
Open

            if (currBureau !== nextBureau) {
              const summaryBody = {
                // the alternative zero is to prevent the value from being falsy
                'Bureau: ': bureauSummary?.bureau_short_desc,
                'Total POS': bureauSummary?.total_pos || '0',
Severity: Critical
Found in src/Components/AdministratorPage/OrgStats/OrgStats.jsx - About 2 hrs to fix

    Function OrgStats has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    const OrgStats = () => {
      const dispatch = useDispatch();
    
      // ================= DATA RETRIEVAL =================
      const userSelections = useSelector(state => state.orgStatsSelections);
    Severity: Minor
    Found in src/Components/AdministratorPage/OrgStats/OrgStats.jsx - About 1 hr 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