department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,848 of 12,848 total issues

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

        <va-text-input
          hint={null}
          currency
          inputmode="decimal"
          label="Original loan amount"
src/applications/financial-status-report/components/householdExpenses/InstallmentContract.jsx on lines 340..351

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

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 (error) {
      return (
        <va-alert status="error" visible class="vads-u-margin-y--9">
          <h2 slot="headline">We’re sorry. Something went wrong on our end</h2>
          <p>
src/applications/mhv-secure-messaging/containers/Compose.jsx on lines 105..115

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

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

    function needsOffset (m) {
        var isUnixTimestamp = (m._f === 'X' || m._f === 'x');
        return !!(m._a && (m._tzm === undefined) && !isUnixTimestamp);
    }
Severity: Major
Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 1 hr to fix
src/applications/personalization/dashboard/lib/moment-tz.js on lines 511..514

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

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

      case FIELD_NAMES.GENDER_IDENTITY:
        apiRoute = API_ROUTES.GENDER_IDENTITY;
        title = FIELD_TITLES[FIELD_NAMES.GENDER_IDENTITY];
        convertCleanDataToPayload = payload => {
          return {
src/platform/user/profile/vap-svc/util/getProfileInfoFieldAttributes.js on lines 109..117

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

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 (key === VA_FORM_IDS.FORM_40_10007) {
      formNumber = '';
    } else if (key === VA_FORM_IDS.FORM_10_10EZ) {
      formNumber = '(10-10EZ)';
    } else {
Severity: Major
Found in src/platform/forms/constants.js and 1 other location - About 1 hr to fix
src/platform/forms/constants.js on lines 499..505

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

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 otherSourcesDescription = (
  <div>
    <h3 className="vads-u-font-size--h5">Other sources of information</h3>
    <p>
      If you were treated at a military or private facility for this event, or
src/applications/disability-benefits/all-claims/content/employmentHistory.jsx on lines 3..16

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

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

  spouse: (
    <p>
      Spouse or surviving spouse
      <>
        <br />
Severity: Major
Found in src/applications/edu-benefits/5490/helpers.jsx and 1 other location - About 1 hr to fix
src/applications/edu-benefits/5490/helpers.jsx on lines 29..44

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

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 checkBenefit = () => {
  return (
    <div>
      <a
        aria-label="Check your remaining benefits, opening in new tab"
src/applications/edu-benefits/10203/content/stemEligibility.jsx on lines 3..16

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

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

const generateHeaderBanner = async (doc, header, data, config) => {
  doc.moveDown(1);
  const currentHeight = doc.y;

  // Calculate text width
Severity: Minor
Found in src/platform/pdf/templates/utils.js - About 1 hr to fix

    Function generateInfoSection has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const generateInfoSection = (doc, parent) => {
      const infoSection = doc.struct('Sect', {
        title: 'Information',
      });
      infoSection.add(
    Severity: Minor
    Found in src/platform/pdf/templates/blue_button_report.js - About 1 hr to fix

      Function currentOrPastDateUI has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const currentOrPastDateUI = options => {
        const { title, errorMessages, required, ...uiOptions } =
          typeof options === 'object' ? options : { title: options };
      
        // if monthYearOnly is used, the schema pattern also needs

        Function componentDidUpdate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          componentDidUpdate(prevProps) {
            const {
              fieldName,
              forceEditView,
              successCallback,

          Function handleSubmit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const handleSubmit = event => {
              if (!event.target.value) {
                setInputError(true);
                return;
              }
          Severity: Minor
          Found in src/applications/resources-and-support/components/SearchBar.jsx - About 1 hr to fix

            Function transform has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function transform(formConfig, form) {
              // https://dev-developer.va.gov/explore/appeals/docs/decision_reviews?version=current
              const mainTransform = formData => {
                const informalConference = showNewHlrContent(formData)
                  ? formData.informalConferenceChoice === 'yes'
            Severity: Minor
            Found in src/applications/appeals/996/config/submit-transformer.js - About 1 hr to fix

              Function displayConditionsMet has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const displayConditionsMet = (SHORT_NAME, formResponses) => {
                const displayConditionsForShortName = DISPLAY_CONDITIONS[SHORT_NAME];
                const questionRequirements = Object.keys(displayConditionsForShortName);
              
                if (questionRequirements.includes('FORK')) {

                Function ClaimantContactInformation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function ClaimantContactInformation(props) {
                  const formikContext = useFormikContext();
                
                  return (
                    <>
                Severity: Minor
                Found in src/applications/burial-poc-v6/pages/ClaimantContactInformation.jsx - About 1 hr to fix

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

                    render() {
                      const { error, fetching, results, scopes } = this.props;
                  
                      // Show loading indicator if we are fetching.
                      if (fetching) {

                    Function answerReviewLabel has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const answerReviewLabel = (key, formValues) => {
                      const answer = formValues[key];
                    
                      const dischargeMonth =
                        monthLabelMap[formValues[SHORT_NAME_MAP.DISCHARGE_MONTH]] || '';
                    Severity: Minor
                    Found in src/applications/discharge-wizard/helpers/index.jsx - About 1 hr to fix

                      Function additionalBenefits has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function additionalBenefits(schema, options) {
                        // Use the defaults as necessary, but override with the options given
                        const mergedOptions = { ...defaults, ...options };
                        const { fields, required } = mergedOptions;
                      
                      
                      Severity: Minor
                      Found in src/applications/edu-benefits/pages/additionalBenefits.js - About 1 hr to fix

                        Function mapEnrollmentVerificationsForSubmission has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const mapEnrollmentVerificationsForSubmission = ev => {
                          // The enrollments are in order with the most recent first.  Look
                          // for the first non-null verificationStatus (or, the most recent
                          // month) that was verified as either correct or incorrect.
                          const mostRecentVerifiedEnrollmentIndex = ev.enrollmentVerifications.findIndex(
                        Severity: Minor
                        Found in src/applications/enrollment-verification/helpers/index.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language