department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

File YourClaimsPageV2.jsx has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { connect } from 'react-redux';
import { VaPagination } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import PropTypes from 'prop-types';

Severity: Minor
Found in src/applications/claims-status/containers/YourClaimsPageV2.jsx - About 3 hrs to fix

    File ComparePage.jsx has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, {
      useEffect,
      useRef,
      useState,
      useCallback,
    Severity: Minor
    Found in src/applications/gi/containers/ComparePage.jsx - About 3 hrs to fix

      File index.jsx has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable react/sort-prop-types */
      /* eslint-disable react/static-property-placement */
      // Dependencies.
      import React, { Component } from 'react';
      import {
      Severity: Minor
      Found in src/applications/yellow-ribbon/containers/SearchResults/index.jsx - About 3 hrs to fix

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

          render() {
            const { route } = this.props;
            const { formConfig, pageList } = route;
        
            return (

          Function FileFieldCustom has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function FileFieldCustom(props) {
            const updateButton = (
              // eslint-disable-next-line @department-of-veterans-affairs/prefer-button-component
              <button type="submit" onClick={props.updatePage}>
                Update page

            Function renderResultsSection has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const renderResultsSection = () => {
                const {
                  currentQuery,
                  searchResults,
                  pagination,
            Severity: Major
            Found in src/applications/representative-search/containers/SearchPage.jsx - About 3 hrs to fix

              Function usePostTravelOnlyClaim has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const usePostTravelOnlyClaim = props => {
                const { router } = props;
                const { jumpToPage } = useFormRouting(router);
                const [isLoading, setIsLoading] = useState(false);
                const [isComplete, setIsComplete] = useState(false);
              Severity: Major
              Found in src/applications/check-in/hooks/usePostTravelOnlyClaim.jsx - About 3 hrs to fix

                Function useFormRouting has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const useFormRouting = (router = {}) => {
                  const selectForm = useMemo(makeSelectForm, []);
                  const { pages, data } = useSelector(selectForm);
                
                  const selectApp = useMemo(makeSelectApp, []);
                Severity: Major
                Found in src/applications/check-in/hooks/useFormRouting.jsx - About 3 hrs to fix

                  File actions.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import * as Sentry from '@sentry/browser';
                  
                  import recordEvent from '../../monitoring/record-event';
                  import { logOut } from '../../user/authentication/actions';
                  import { apiRequest } from '../../utilities/api';
                  Severity: Minor
                  Found in src/platform/forms/save-in-progress/actions.js - About 3 hrs to fix

                    Function OfficialGovtWebsite has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const OfficialGovtWebsite = () => {
                      const [expanded, setExpanded] = useState(false);
                    
                      const onToggle = () => {
                        if (expanded) {
                    Severity: Major
                    Found in src/platform/site-wide/header/components/OfficialGovtWebsite/index.js - About 3 hrs to fix

                      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 AdditionalConsiderationTemplate has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function AdditionalConsiderationTemplate(page, formField, options = {}) {
                          const { title, additionalInfo } = page;
                          const additionalInfoViewName = `view:${page.name}AdditionalInfo`;
                          const displayTypeMapping = {
                            [formFields.federallySponsoredAcademy]: 'Academy',

                          Function priorServiceStatement has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            const priorServiceStatement = () => {
                              const onDD214LinkClick = () => {
                                router.push(ROUTES.DD214);
                              };
                          
                          

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

                              render() {
                                const { form } = this.props;
                                const { submission, data } = form;
                            
                                const submitDate = new Date(submission?.timestamp);

                              Function onAddFile has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                const onAddFile = async (event, index = null, password) => {
                                  if (event.target?.files?.length) {
                                    const currentFile = event.target.files[0];
                                    const allFiles = props.formData || [];
                                    const addUiOptions = props.uiSchema['ui:options'];
                              Severity: Major
                              Found in src/applications/pre-need/components/FileField.jsx - About 3 hrs to fix

                                Function onAddFile has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const onAddFile = async (event, index = null, password) => {
                                    if (event.target?.files?.length) {
                                      const currentFile = event.target.files[0];
                                      const allFiles = props.formData || [];
                                      const addUiOptions = props.uiSchema['ui:options'];
                                Severity: Major
                                Found in src/applications/simple-forms/40-0247/components/FileField.jsx - About 3 hrs to fix

                                  Function ApplicationDownloadLink has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const ApplicationDownloadLink = () => {
                                    const [loading, isLoading] = useState(false);
                                    const [errors, setErrors] = useState([]);
                                  
                                    // define local use variables
                                  Severity: Major
                                  Found in src/applications/caregivers/components/ApplicationDownloadLink.jsx - About 3 hrs to fix

                                    Function ClosestCityStatePage has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export default function ClosestCityStatePage() {
                                      const pageTitle = useSelector(state => getPageTitle(state, pageKey));
                                    
                                      const uiSchema = {
                                        communityCareSystemId: {

                                      Function HealthConditions has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const HealthConditions = () => {
                                        const dispatch = useDispatch();
                                        const updatedRecordList = useSelector(
                                          state => state.mr.conditions.updatedList,
                                        );
                                      Severity: Major
                                      Found in src/applications/mhv-medical-records/containers/HealthConditions.jsx - About 3 hrs to fix

                                        Identical blocks of code found in 6 locations. Consider refactoring.
                                        Open

                                          if (suffix) {
                                            newData[formFields.viewUserFullName].userFullName.suffix =
                                              state?.form?.pages?.applicantInformation?.schema?.properties[
                                                formFields.viewUserFullName
                                              ]?.properties?.userFullName?.properties?.suffix?.enum?.find(e =>
                                        Severity: Major
                                        Found in src/applications/my-education-benefits/helpers.js and 5 other locations - About 3 hrs to fix
                                        src/applications/my-education-benefits/helpers.js on lines 360..367
                                        src/applications/my-education-benefits/helpers.js on lines 490..497
                                        src/applications/my-education-benefits/helpers.js on lines 639..646
                                        src/applications/toe/helpers.jsx on lines 209..216
                                        src/applications/toe/helpers.jsx on lines 339..346

                                        Duplicated Code

                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                        Tuning

                                        This issue has a mass of 99.

                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                        Refactorings

                                        Further Reading

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language