department-of-veterans-affairs/vets-website

View on GitHub
src/platform/forms/save-in-progress/RoutedSavableApp.jsx

Summary

Maintainability
C
1 day
Test Coverage

File RoutedSavableApp.jsx has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import Scroll from 'react-scroll';
import { withRouter } from 'react-router';
import { connect } from 'react-redux';
Severity: Minor
Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 3 hrs to fix

    Function UNSAFE_componentWillReceiveProps has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      UNSAFE_componentWillReceiveProps(newProps) {
        // When a user is logged in, the profile finishes loading after the component
        //  has mounted, so we check here.
        // If we're done loading the profile, check to see if we should load or redirect
        if (
    Severity: Minor
    Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 2 hrs 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

    Function UNSAFE_componentWillReceiveProps has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      UNSAFE_componentWillReceiveProps(newProps) {
        // When a user is logged in, the profile finishes loading after the component
        //  has mounted, so we check here.
        // If we're done loading the profile, check to see if we should load or redirect
        if (
    Severity: Major
    Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 2 hrs to fix

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

        render() {
          const { currentLocation, formConfig, children, loadedStatus } = this.props;
          const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
          const trimmedPathname = currentLocation.pathname.replace(/\/$/, '');
          let content;
      Severity: Minor
      Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 1 hr to fix

        Function redirectOrLoad has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          redirectOrLoad(props) {
            // Stop a user that's been redirected from being redirected again after
            // logging in
            this.shouldRedirectOrLoad = false;
        
        
        Severity: Minor
        Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 1 hr to fix

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

            render() {
              const { currentLocation, formConfig, children, loadedStatus } = this.props;
              const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
              const trimmedPathname = currentLocation.pathname.replace(/\/$/, '');
              let content;
          Severity: Minor
          Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - 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

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

            redirectOrLoad(props) {
              // Stop a user that's been redirected from being redirected again after
              // logging in
              this.shouldRedirectOrLoad = false;
          
          
          Severity: Minor
          Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - 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