department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

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

  {
    type: 'recentMessage',
    previous: 'recentApplication',
    component: () => (
      <div className="vads-u-margin-top--3">
Severity: Major
Found in src/applications/post-911-gib-status/utils/wizardConfig.js and 1 other location - About 3 hrs to fix
src/applications/post-911-gib-status/utils/wizardConfig.js on lines 79..98

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

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

          schema: {
            type: 'object',
            properties: {
              'view:subHeadings': {
                type: 'object',
Severity: Major
Found in src/applications/fry-dea/config/form.js and 1 other location - About 3 hrs to fix
src/applications/toe/config/form.js on lines 779..802

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

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 uiSchema = {
  application: {
    'ui:title': applicantDemographicsPreparerSubHeader,
    'view:applicantDemographicsDescription': {
      'ui:description': applicantDemographicsDescription,
src/applications/pre-need-integration/config/pages/sponsorRace.jsx on lines 12..32

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

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

    <va-alert status="error">
      <h2 slot="headline">We’re sorry. Something went wrong on our end.</h2>
      <p className="vads-u-font-size--base">
        Please refresh this page or check back later. You can also sign out of
        VA.gov and try signing back into this page.
src/applications/personalization/view-dependents/manage-dependents/utils/index.js on lines 11..26

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

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 uiSchema = {
  application: {
    'ui:title': sponsorDemographicsSubHeader,
    'view:sponsorDemographicsDescription': {
      'ui:description': sponsorDemographicsDescription,
src/applications/pre-need-integration/config/pages/applicantDemographics2Preparer.jsx on lines 13..33

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

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

const jurisdictionsPages = arrayBuilderPages(
  arrayBuilderOptions,
  pageBuilder => ({
    jurisdictionsSummary: pageBuilder.summaryPage({
      title: 'Review your jurisdictions',
src/applications/accredited-representative-portal/accreditation/21a/pages/05-professional-affiliations-chapter/agenciesOrCourtsPages.js on lines 106..122

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

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

          schema: {
            type: 'object',
            properties: {
              'view:subHeadings': {
                type: 'object',
Severity: Major
Found in src/applications/toe/config/form.js and 1 other location - About 3 hrs to fix
src/applications/fry-dea/config/form.js on lines 966..989

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

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

Function mapRawUserDataToState has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function mapRawUserDataToState(json) {
  const {
    data: {
      attributes: {
        account: { accountUuid } = {},
Severity: Major
Found in src/platform/user/profile/utilities/index.js - About 3 hrs to fix

    Function render has 82 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 data has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        data: (state = initialState, action) => {
          switch (action.type) {
            case FETCH_POST_911_GI_BILL_ELIGIBILITY_SUCCESS:
              return {
                ...state,
      Severity: Major
      Found in src/applications/enrollment-verification/reducers/index.js - About 3 hrs to fix

        Function createClaimsSuccess has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const createClaimsSuccess = (updatedDaysAgo = 1, open = true) => {
          const daysAgo = subDays(new Date(), updatedDaysAgo);
          const formattedDaysAgo = format(daysAgo, 'yyyy-MM-dd');
          return {
            data: [
        Severity: Major
        Found in src/applications/personalization/dashboard/mocks/claims/index.js - About 3 hrs to fix

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

          export function prefillTransformer(pages, formData, metadata) {
            const prefillPersonalInformation = data => {
              const newData = _.omit(['personalInformation'], data);
              const { personalInformation } = data;
          
          
          Severity: Major
          Found in src/applications/representative-appoint/prefill-transformer.js - About 3 hrs to fix

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

              render() {
                const { uiSchema, errorSchema, idSchema, schema, formContext } = this.props;
                const { SchemaField } = this.props.registry.fields || {};
            
                const properties = Object.keys(schema.properties);
            Severity: Minor
            Found in src/platform/forms-system/src/js/review/ObjectField.jsx - About 3 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 setHiddenFields has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            export function setHiddenFields(schema, uiSchema, formData, path = []) {
              if (!uiSchema) {
                return schema;
              }
            
            
            Severity: Minor
            Found in src/platform/forms-system/src/js/state/helpers.js - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                const {
                  uiSchema,
                  errorSchema,
                  idSchema,
            Severity: Minor
            Found in src/platform/forms-system/src/js/fields/ObjectField.jsx - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                const {
                  uiSchema,
                  errorSchema,
                  idSchema,

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

            const AddIssue = ({
              validations,
              description,
              data,
              goToPath,
            Severity: Minor
            Found in src/applications/appeals/shared/components/AddIssue.jsx - About 3 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 FileFieldCustom has a Cognitive Complexity of 23 (exceeds 5 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

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

            const ContactInfo = ({
              data,
              goBack,
              goForward,
              onReviewPage,

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

            export const Form526Entry = ({
              children,
              inProgressFormId,
              isBDDForm,
              location,
            Severity: Minor
            Found in src/applications/disability-benefits/all-claims/Form526EZApp.jsx - About 3 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

            Severity
            Category
            Status
            Source
            Language