department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,841 of 12,841 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if (address.length !== 0) {
    address = address.join(', ');
  } else {
    // If we don't have an address fallback on coords
    const { lat, long } = location.attributes;
src/applications/static-pages/facilities/FacilityAddress.jsx on lines 7..13

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 78.

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            {
              type: 'still_need_from_you_list',
              trackedItemId: 51,
              description: 'What we still need from you item two.',
              displayName: 'Request 2',
src/platform/testing/e2e/cypress/support/commands/mockHelpers.js on lines 120..137

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 78.

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const VerifiedAlert = (
  <div>
    <div className="usa-alert usa-alert-info schemaform-sip-alert">
      <div className="usa-alert-body">
        <strong>Note:</strong> Since you’re signed in to your account and your
src/applications/disability-benefits/686c-674-v2/config/helpers.js on lines 8..20

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 78.

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

File index.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { stateList } from './stateList';

const APP_NAMES = Object.freeze({
  CHECK_IN: 'dayOf',
  PRE_CHECK_IN: 'preCheckIn',
Severity: Minor
Found in src/applications/check-in/utils/appConstants/index.js - About 2 hrs to fix

    File contactInformation.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    // import _ from 'platform/utilities/data';
    import merge from 'lodash/merge';
    import omit from 'platform/utilities/data/omit';
    import fullSchema from 'vets-json-schema/dist/21-526EZ-ALLCLAIMS-schema.json';

      File search.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import camelCaseKeysRecursive from 'camelcase-keys-recursive';
      
      import {
        SEARCH_STARTED,
        SEARCH_FAILED,
      Severity: Minor
      Found in src/applications/gi/reducers/search.js - About 2 hrs to fix

        File index.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        const maximalSetOfPreferences = {
          data: {
            id: '',
            type: 'hashes',
            attributes: {

          File index.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          const createDebtsSuccess = () => {
            return {
              hasDependentDebts: false,
              debts: [
                {
          Severity: Minor
          Found in src/applications/personalization/dashboard/mocks/debts/index.js - About 2 hrs to fix

            File config.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import environment from 'platform/utilities/environment';
            import compact from 'lodash/compact';
            import {
              LocationType,
              FacilityType,
            Severity: Minor
            Found in src/applications/facility-locator/config.js - About 2 hrs to fix

              Function submitTransformer has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function submitTransformer(formConfig, form) {
                const { data: formData, loadedData } = form;
                const expandedPages = expandArrayPages(
                  createFormPageList(formConfig),
                  formData,
              Severity: Major
              Found in src/applications/ezr/utils/helpers/submit-transformer.js - About 2 hrs to fix

                Function updateSchema has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      updateSchema: (formData, addressSchema, addressUiSchema, index, path) => {
                        let currentSchema = addressSchema;
                
                        const modifiedData = { ...formData };
                
                
                Severity: Major
                Found in src/applications/pre-need/definitions/address.js - About 2 hrs to fix

                  Function submitTransformer has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function submitTransformer(formConfig, form) {
                    const { data: formData, loadedData } = form;
                    const expandedPages = expandArrayPages(
                      createFormPageList(formConfig),
                      formData,

                    Function IdentityVerificationAlert has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const IdentityVerificationAlert = () => {
                      const onVerify = () => recordEvent({ event: AUTH_EVENTS.VERIFY });
                      return (
                        <va-alert status="continue" data-testid="hca-identity-alert" uswds>
                          <h2 slot="headline">

                      Function data has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        data: (state = initialState, action) => {
                          switch (action.type) {
                            case FETCH_PERSONAL_INFORMATION:
                              return {
                                ...state,

                        Function getPtsdClassification has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const getPtsdClassification = (formData, formType) => {
                          const isCombat = _.get(
                            'view:selectablePtsdTypes.view:combatPtsdType',
                            formData,
                            false,

                          Function itemsList has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                items.map((item, index) => {
                                  const itemIsSelected = !!get(
                                    selectedPropName || this.defaultSelectedPropName,
                                    item,
                                  );

                            File DashboardCards.jsx has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import {
                              VaPagination,
                              VaSelect,
                            } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
                            import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api';
                            Severity: Minor
                            Found in src/applications/ask-va/containers/DashboardCards.jsx - About 2 hrs to fix

                              Function DashboardUnreadMessages has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const DashboardUnreadMessages = props => {
                                const { inbox } = props;
                              
                                const { noAssociations, allTriageGroupsBlocked } = useSelector(
                                  state => state.sm.recipients,

                                Function perTermSections has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const perTermSections = () => {
                                    const { perTerm } = outputs;
                                
                                    const sections = Object.keys(perTerm).map(section => {
                                      const {
                                Severity: Major
                                Found in src/applications/gi/components/profile/EstimatedBenefits.jsx - About 2 hrs to fix

                                  Function ReplaceAccreditedRepresentative has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const ReplaceAccreditedRepresentative = props => {
                                    const { formData } = props;
                                  
                                    const currentRepresentative =
                                      formData?.['view:representativeStatus']?.attributes || {};
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language