department-of-veterans-affairs/vets-website

View on GitHub
src/applications/financial-status-report/utils/validations.js

Summary

Maintainability
F
5 days
Test Coverage

File validations.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'platform/utilities/data';
import { isValidPhone, isValidEmail } from 'platform/forms/validations';
import {
  MILITARY_CITY_CODES,
  MILITARY_STATE_CODES,
Severity: Minor
Found in src/applications/financial-status-report/utils/validations.js - About 3 hrs to fix

    Function validateResolutionOption has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const validateResolutionOption = (errors, fieldData) => {
      if (
        fieldData &&
        (fieldData.resolutionOption !== 'waiver' &&
          fieldData.resolutionOption !== 'compromise' &&
    Severity: Minor
    Found in src/applications/financial-status-report/utils/validations.js - About 35 mins 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 validateResolutionAmount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export const validateResolutionAmount = (errors, fieldData) => {
      // fieldData is each individual debt object
      const { debtType, resolutionComment, resolutionOption } = fieldData;
    
      // not required for waiver
    Severity: Minor
    Found in src/applications/financial-status-report/utils/validations.js - About 25 mins 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

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

    export const validateMilitaryState = (
      errors,
      state,
      formData,
      schema,
    src/applications/disability-benefits/all-claims/validations.js on lines 110..132

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

    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 validateMilitaryCity = (
      errors,
      city,
      formData,
      schema,
    src/applications/disability-benefits/all-claims/validations.js on lines 75..97

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

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

    export const validateOtherAssetsArrayLimits = (errors, fieldData) => {
      if (fieldData) {
        fieldData.map(income => {
          if (
            income.amount > VALIDATION_LIMITS.OTHER_ASSETS_MAX ||
    src/applications/financial-status-report/utils/validations.js on lines 184..197
    src/applications/financial-status-report/utils/validations.js on lines 199..212
    src/applications/financial-status-report/utils/validations.js on lines 214..230
    src/applications/financial-status-report/utils/validations.js on lines 247..260
    src/applications/financial-status-report/utils/validations.js on lines 262..275
    src/applications/financial-status-report/utils/validations.js on lines 277..290

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

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

    export const validateAdditionalIncomeArrayLimits = (errors, fieldData) => {
      if (fieldData) {
        fieldData.map(income => {
          if (
            income.amount > VALIDATION_LIMITS.ADDITIONAL_INCOME_MAX ||
    src/applications/financial-status-report/utils/validations.js on lines 184..197
    src/applications/financial-status-report/utils/validations.js on lines 214..230
    src/applications/financial-status-report/utils/validations.js on lines 232..245
    src/applications/financial-status-report/utils/validations.js on lines 247..260
    src/applications/financial-status-report/utils/validations.js on lines 262..275
    src/applications/financial-status-report/utils/validations.js on lines 277..290

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

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

    export const validateHouseholdExpensesArrayLimits = (errors, fieldData) => {
      if (fieldData) {
        fieldData.map(income => {
          if (
            income.amount > VALIDATION_LIMITS.HOUSEHOLD_EXPENSES_MAX ||
    src/applications/financial-status-report/utils/validations.js on lines 184..197
    src/applications/financial-status-report/utils/validations.js on lines 199..212
    src/applications/financial-status-report/utils/validations.js on lines 214..230
    src/applications/financial-status-report/utils/validations.js on lines 232..245
    src/applications/financial-status-report/utils/validations.js on lines 262..275
    src/applications/financial-status-report/utils/validations.js on lines 277..290

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

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

    export const validateMonetaryAssetCurrencyArrayLimits = (errors, fieldData) => {
      if (fieldData) {
        fieldData.map(income => {
          if (
            income.amount > VALIDATION_LIMITS.MONETARY_ASSET_MAX ||
    src/applications/financial-status-report/utils/validations.js on lines 199..212
    src/applications/financial-status-report/utils/validations.js on lines 214..230
    src/applications/financial-status-report/utils/validations.js on lines 232..245
    src/applications/financial-status-report/utils/validations.js on lines 247..260
    src/applications/financial-status-report/utils/validations.js on lines 262..275
    src/applications/financial-status-report/utils/validations.js on lines 277..290

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

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

    export const validateSpouseAdditionalIncomeArrayLimits = (
      errors,
      fieldData,
    ) => {
      if (fieldData) {
    src/applications/financial-status-report/utils/validations.js on lines 184..197
    src/applications/financial-status-report/utils/validations.js on lines 199..212
    src/applications/financial-status-report/utils/validations.js on lines 232..245
    src/applications/financial-status-report/utils/validations.js on lines 247..260
    src/applications/financial-status-report/utils/validations.js on lines 262..275
    src/applications/financial-status-report/utils/validations.js on lines 277..290

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

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

    export const validateOtherExpensesArrayLimits = (errors, fieldData) => {
      if (fieldData) {
        fieldData.map(income => {
          if (
            income.amount > VALIDATION_LIMITS.OTHER_EXPENSE_MAX ||
    src/applications/financial-status-report/utils/validations.js on lines 184..197
    src/applications/financial-status-report/utils/validations.js on lines 199..212
    src/applications/financial-status-report/utils/validations.js on lines 214..230
    src/applications/financial-status-report/utils/validations.js on lines 232..245
    src/applications/financial-status-report/utils/validations.js on lines 247..260
    src/applications/financial-status-report/utils/validations.js on lines 262..275

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

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

    export const validateUtilityBillsArrayLimits = (errors, fieldData) => {
      if (fieldData) {
        fieldData.map(income => {
          if (
            income.amount > VALIDATION_LIMITS.UTILITY_BILL_MAX ||
    src/applications/financial-status-report/utils/validations.js on lines 184..197
    src/applications/financial-status-report/utils/validations.js on lines 199..212
    src/applications/financial-status-report/utils/validations.js on lines 214..230
    src/applications/financial-status-report/utils/validations.js on lines 232..245
    src/applications/financial-status-report/utils/validations.js on lines 247..260
    src/applications/financial-status-report/utils/validations.js on lines 277..290

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

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

    export const validateRealEstateRecordAssetsLimits = (errors, amount) => {
      if (
        amount &&
        (amount > VALIDATION_LIMITS.REAL_ESTATE_ASSETS_MAX ||
          amount < VALIDATION_LIMITS.REAL_ESTATE_ASSETS_MIN)
    src/applications/financial-status-report/utils/validations.js on lines 292..301
    src/applications/financial-status-report/utils/validations.js on lines 303..312
    src/applications/financial-status-report/utils/validations.js on lines 325..334

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

    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

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

    export const validateCurrency = (errors, currencyAmount) => {
      const regex = /(?=.*?\d)^\$?(([1-9]\d{0,2}(,\d{3})*)|\d+)?(\.\d{1,2})?$/;
    
      if (!regex.test(currencyAmount) || Number(currencyAmount) < 0) {
        errors.addError('Please enter a valid dollar amount.');
    src/applications/pensions/validation.js on lines 49..54

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

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

    export const validateSpouseBenefitsVaCompensationimits = (errors, amount) => {
      if (
        amount &&
        (amount > VALIDATION_LIMITS.SPOUSE_BENEFIT_MAX ||
          amount < VALIDATION_LIMITS.SPOUSE_BENEFIT_MIN)
    src/applications/financial-status-report/utils/validations.js on lines 303..312
    src/applications/financial-status-report/utils/validations.js on lines 314..323
    src/applications/financial-status-report/utils/validations.js on lines 325..334

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

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

    export const validateSpouseBenefitsVaEducationLimits = (errors, amount) => {
      if (
        amount &&
        (amount > VALIDATION_LIMITS.SPOUSE_BENEFIT_MAX ||
          amount < VALIDATION_LIMITS.SPOUSE_BENEFIT_MIN)
    src/applications/financial-status-report/utils/validations.js on lines 292..301
    src/applications/financial-status-report/utils/validations.js on lines 314..323
    src/applications/financial-status-report/utils/validations.js on lines 325..334

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

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

    export const validateRecreationalVechicleAssetsLimits = (errors, amount) => {
      if (
        amount &&
        (amount > VALIDATION_LIMITS.RECREATIONAL_VEHICLE_ASSETS_MAX ||
          amount < VALIDATION_LIMITS.RECREATIONAL_VEHICLE_ASSETS_MIN)
    src/applications/financial-status-report/utils/validations.js on lines 292..301
    src/applications/financial-status-report/utils/validations.js on lines 303..312
    src/applications/financial-status-report/utils/validations.js on lines 314..323

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

    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 validateAddlIncomeValues = (errors, addlIncome) => {
      addlIncome.map(income => {
        return !isValidCurrency(income.amount)
          ? errors.addError(income.name)
          : null;
    Severity: Minor
    Found in src/applications/financial-status-report/utils/validations.js and 1 other location - About 50 mins to fix
    src/applications/financial-status-report/utils/validations.js on lines 168..174

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

    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 (fieldData) {
        fieldData.map(income => {
          return !isValidCurrency(income.amount)
            ? errors.addError(income.name)
            : null;
    Severity: Minor
    Found in src/applications/financial-status-report/utils/validations.js and 1 other location - About 50 mins to fix
    src/applications/financial-status-report/utils/validations.js on lines 159..165

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

    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

              : `${currency(fieldData.pHAmtDue)} copay debt  ${
                  fieldData.station ? `for ${fieldData.station.facilityName}` : ''
                }`
    Severity: Minor
    Found in src/applications/financial-status-report/utils/validations.js and 1 other location - About 40 mins to fix
    src/applications/financial-status-report/components/shared/CurrentDebtTitle.jsx on lines 20..22

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

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

    export const validateZIP = (errors, zip) => {
      if (zip && !isValidZIP(zip)) {
        errors.addError(
          'Please enter a valid 5- or 9-digit postal code (dashes allowed)',
        );
    Severity: Major
    Found in src/applications/financial-status-report/utils/validations.js and 5 other locations - About 30 mins to fix
    src/applications/financial-status-report/utils/validations.js on lines 93..97
    src/applications/financial-status-report/utils/validations.js on lines 99..103
    src/applications/my-education-benefits/utils/validation.js on lines 41..45
    src/applications/toe/utils/validation.js on lines 73..77
    src/applications/fry-dea/validation.js on lines 46..50

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

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

    export const validateEmail = (errors, email) => {
      if (email && !isValidEmail(email)) {
        errors.addError('Please enter a valid email address.');
      }
    };
    Severity: Major
    Found in src/applications/financial-status-report/utils/validations.js and 5 other locations - About 30 mins to fix
    src/applications/financial-status-report/utils/validations.js on lines 27..33
    src/applications/financial-status-report/utils/validations.js on lines 93..97
    src/applications/my-education-benefits/utils/validation.js on lines 41..45
    src/applications/toe/utils/validation.js on lines 73..77
    src/applications/fry-dea/validation.js on lines 46..50

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

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

    export const validatePhone = (errors, phone) => {
      if (phone && !isValidPhone(phone)) {
        errors.addError('Please enter a valid phone number.');
      }
    };
    Severity: Major
    Found in src/applications/financial-status-report/utils/validations.js and 5 other locations - About 30 mins to fix
    src/applications/financial-status-report/utils/validations.js on lines 27..33
    src/applications/financial-status-report/utils/validations.js on lines 99..103
    src/applications/my-education-benefits/utils/validation.js on lines 41..45
    src/applications/toe/utils/validation.js on lines 73..77
    src/applications/fry-dea/validation.js on lines 46..50

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

    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