department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

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

export default function prefillTransformer(formData) {
  const newFormData = {
    ...formData,
  };

Severity: Major
Found in src/applications/representative-appoint/config/prefillTransformer.js - About 2 hrs to fix

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

    const generateStatusResponse = (req, res) => {
      const { id } = req.params;
    
      // increase to use multiple retries
      const requiredRetries = 0;

      File utilities.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable camelcase */
      import environment from 'platform/utilities/environment';
      import recordEvent from 'platform/monitoring/record-event';
      import { teardownProfileSession } from 'platform/user/profile/utilities';
      import { updateLoggedInStatus } from 'platform/user/authentication/actions';
      Severity: Minor
      Found in src/platform/utilities/oauth/utilities.js - About 2 hrs to fix

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

          render() {
            const {
              formIds,
              profile,
              login,
        Severity: Minor
        Found in src/platform/forms/save-in-progress/ApplicationStatus.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 SubTask has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export const SubTask = props => {
          const { pages = [], formData, setFormData, router, focusOnAlertRole } = props;
          const [currentPage, setCurrentPage] = useState(pages[0] || {});
          const [subTaskData, setSubTaskData] = useState(getStoredSubTask());
          const [hasError, setHasError] = useState(false);
        Severity: Minor
        Found in src/platform/forms/sub-task/index.js - 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 render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          render() {
            const {
              route,
              params,
              form,
        Severity: Minor
        Found in src/platform/forms-system/src/js/containers/FormPage.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 navigateForward has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export const navigateForward = (SHORT_NAME, formResponses, router) => {
          const roadmap = makeRoadmap(getServicePeriodResponse(formResponses));
        
          if (roadmap?.length) {
            const CURRENT_INDEX = roadmap?.indexOf(SHORT_NAME);
        Severity: Minor
        Found in src/applications/pact-act/utilities/page-navigation.js - 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 AreaOfDisagreement has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const AreaOfDisagreement = ({
          data = {},
          pagePerItemIndex,
          goBack,
          goForward,

        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 sortTheResults has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export const sortTheResults = (sortByPropertyName, indexA, indexB) => {
          // -n (negative number) sorts indexA to the front of the array.
          // n (positive number) sorts indexA to the back of the array.
          // stayPut keeps both indexA and indexB right where they are.
          const [
        Severity: Minor
        Found in src/applications/find-forms/helpers/index.js - 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 transform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export function transform(formConfig, form) {
          // Copy over sponsor data if the claimant is the veteran.
          const populateSponsorData = application =>
            isVeteran({ application })
              ? merge({}, application, {
        Severity: Minor
        Found in src/applications/pre-need/utils/helpers.js - 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 SuggestedAddress has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const SuggestedAddress = ({
          formData,
          address,
          handleAddNewClick,
          setAddressToUI,

        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 TermsOfUse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function TermsOfUse() {
          const isAuthenticatedWithSiS = useSelector(isAuthenticatedWithOAuth);
          const isAuthenticatedWithIAM = useSelector(isAuthenticatedWithSSOe);
          const [isDisabled, setIsDisabled] = useState(false);
          const [isMiddleAuth, setIsMiddleAuth] = useState(true);
        Severity: Minor
        Found in src/applications/terms-of-use/containers/TermsOfUse.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 prefillTransformerV1 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export function prefillTransformerV1(pages, formData, metadata, state) {
          const bankInformation = state.data?.bankInformation || {};
          const claimant = state.data?.formData?.data?.attributes?.claimant || {};
          const contactInfo = claimant?.contactInfo || {};
          const sponsors = state.data?.formData?.attributes?.sponsors;
        Severity: Minor
        Found in src/applications/toe/helpers.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 homelessOrAtRisk has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          homelessOrAtRisk: formData => {
            // Much of the logic in here to get when a field is required is duplicated from the homelessness page
            const isHomeless =
              formData.homelessOrAtRisk === HOMELESSNESS_TYPES.homeless;
            const isAtRisk = formData.homelessOrAtRisk === HOMELESSNESS_TYPES.atRisk;

        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 AddIncome has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const AddIncome = ({ data, goToPath, setFormData }) => {
          const { additionalIncome } = data;
          const { addlIncRecords = [] } = additionalIncome;
        
          // Borrowed from 995 AddIssue

        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 SpouseAddIncome has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const SpouseAddIncome = ({ data, goToPath, setFormData }) => {
          const { additionalIncome } = data;
          const { spouse } = additionalIncome;
          const { spAddlIncome = [] } = spouse;
        
        

        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 AddUtilityBill has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const AddUtilityBill = ({ data, goToPath, setFormData }) => {
          const { utilityRecords = [] } = data;
        
          // Borrowed from 995 AddIssue
          // get index from url '/add-issue?index={index}'

        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 Navigation has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const Navigation = () => {
          const [isMobile, setIsMobile] = useState(true);
          const [isNavigationOpen, setIsNavigationOpen] = useState(false);
          const location = useLocation();
          const activeFolder = useSelector(folder);
        Severity: Minor
        Found in src/applications/mhv-secure-messaging/components/Navigation.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 ThreadDetails has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const ThreadDetails = props => {
          const { threadId } = useParams();
          const { testing } = props;
          const dispatch = useDispatch();
          const location = useLocation();
        Severity: Minor
        Found in src/applications/mhv-secure-messaging/containers/ThreadDetails.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 RadioWidget has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function RadioWidget(props) {
          const { options, formContext = {}, value, disabled, onChange, id } = props;
          const { enumOptions, labels = {} } = options;
        
          const dispatch = useDispatch();

        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

        Severity
        Category
        Status
        Source
        Language