department-of-veterans-affairs/vets-website

View on GitHub
src/applications/ask-a-question/form/inquiry/topic/topic.js

Summary

Maintainability
F
5 days
Test Coverage

Function uiSchema has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function uiSchema() {
  const topicChangeSelector = createSelector(
    ({ formData }) => get(['topic'].concat('levelOne'), formData),
    ({ formData }) => get(['topic'].concat('levelTwo'), formData),
    ({ topicSchema }) => topicSchema,
Severity: Major
Found in src/applications/ask-a-question/form/inquiry/topic/topic.js - About 7 hrs to fix

    File topic.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { flatten, orderBy } from 'lodash';
    import clone from 'platform/utilities/data/clone';
    import get from 'platform/utilities/data/get';
    import set from 'platform/utilities/data/set';
    import { createSelector } from 'reselect';
    Severity: Minor
    Found in src/applications/ask-a-question/form/inquiry/topic/topic.js - About 5 hrs to fix

      Function schema has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function schema(currentSchema, topicProperty = 'topic') {
        const topicSchema = currentSchema.properties[topicProperty];
        return {
          type: 'object',
          required: ['levelOne', 'levelTwo'],
      Severity: Minor
      Found in src/applications/ask-a-question/form/inquiry/topic/topic.js - About 1 hr to fix

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

              if (
                levelTwoLabelList &&
                topicSchema.properties.levelTwo.enum !== levelTwoLabelList
              ) {
                // We have a list and it’s different, so we need to make schema updates
        Severity: Major
        Found in src/applications/ask-a-question/form/inquiry/topic/topic.js and 1 other location - About 3 hrs to fix
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 258..276

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

        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

                if (
                  levelThreeLabelList &&
                  topicSchema.properties.levelThree.enum !== levelThreeLabelList
                ) {
                  // We have a list and it’s different, so we need to make schema updates
        Severity: Major
        Found in src/applications/ask-a-question/form/inquiry/topic/topic.js and 1 other location - About 3 hrs to fix
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 235..253

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

        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 5 locations. Consider refactoring.
        Open

            [formFields.stateOfResidence]: {
              'ui:title': stateOfResidence,
              'ui:required': formData => {
                return !!showAdditionalGIBillFields.has(formData.topic.levelTwo);
              },
        Severity: Major
        Found in src/applications/ask-a-question/form/inquiry/topic/topic.js and 4 other locations - About 3 hrs to fix
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 316..330
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 331..345
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 346..360
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 386..400

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

        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 5 locations. Consider refactoring.
        Open

            [formFields.routeToState]: {
              'ui:title': routeToStateTitle,
              'ui:required': formData => {
                return !!routeToStateRequiredTopics.has(formData.topic.levelTwo);
              },
        Severity: Major
        Found in src/applications/ask-a-question/form/inquiry/topic/topic.js and 4 other locations - About 3 hrs to fix
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 316..330
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 331..345
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 371..385
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 386..400

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

        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 5 locations. Consider refactoring.
        Open

            [formFields.vaMedicalCenter]: {
              'ui:title': vaMedicalCenterTitle,
              'ui:required': formData => {
                return !!medicalCenterRequiredTopics.has(formData.topic.levelTwo);
              },
        Severity: Major
        Found in src/applications/ask-a-question/form/inquiry/topic/topic.js and 4 other locations - About 3 hrs to fix
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 316..330
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 346..360
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 371..385
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 386..400

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

        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 5 locations. Consider refactoring.
        Open

            [formFields.levelThree]: {
              'ui:title': topicLevelThreeTitle,
              'ui:required': formData => {
                return !!levelThreeRequiredTopics.has(formData.topic.levelTwo);
              },
        Severity: Major
        Found in src/applications/ask-a-question/form/inquiry/topic/topic.js and 4 other locations - About 3 hrs to fix
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 331..345
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 346..360
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 371..385
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 386..400

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

        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 5 locations. Consider refactoring.
        Open

            [formFields.stateOfSchool]: {
              'ui:title': stateOfSchool,
              'ui:required': formData => {
                return !!showAdditionalGIBillFields.has(formData.topic.levelTwo);
              },
        Severity: Major
        Found in src/applications/ask-a-question/form/inquiry/topic/topic.js and 4 other locations - About 3 hrs to fix
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 316..330
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 331..345
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 346..360
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 371..385

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

        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 3 locations. Consider refactoring.
        Open

              stateOfResidence: {
                type: 'string',
                enum: constants.states.USA.map(state => state.value),
                enumNames: constants.states.USA.map(state => state.label),
              },
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 206..210
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 216..220

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

        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 3 locations. Consider refactoring.
        Open

              stateOfSchool: {
                type: 'string',
                enum: constants.states.USA.map(state => state.value),
                enumNames: constants.states.USA.map(state => state.label),
              },
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 206..210
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 211..215

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

        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 3 locations. Consider refactoring.
        Open

              routeToState: {
                type: 'string',
                enum: constants.states.USA.map(state => state.value),
                enumNames: constants.states.USA.map(state => state.label),
              },
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 211..215
        src/applications/ask-a-question/form/inquiry/topic/topic.js on lines 216..220

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

        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

        There are no issues that match your filters.

        Category
        Status