department-of-veterans-affairs/vets-website

View on GitHub
src/platform/pdf/templates/self_entered_info.js

Summary

Maintainability
F
1 wk
Test Coverage

File self_entered_info.js has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Blue Button PDF template.
 *
 * NB: The order in which items are added to the document is important,
 * and thus PDFKit requires performing operations synchronously.
Severity: Minor
Found in src/platform/pdf/templates/self_entered_info.js - About 7 hrs to fix

    Function generate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    const generate = async data => {
      validate(data);
      const doc = createAccessibleDoc(data, config);
    
      await registerVaGovFonts(doc);
    Severity: Minor
    Found in src/platform/pdf/templates/self_entered_info.js - About 4 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 generateContentsSection has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const generateContentsSection = (doc, parent, data) => {
      const infoSection = doc.struct('Sect', {
        title: 'Information',
      });
      const missingRecordSets = Object.values(selfEnteredTypes).filter(
    Severity: Major
    Found in src/platform/pdf/templates/self_entered_info.js - About 3 hrs to fix

      Function generateResultItemContent has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      const generateResultItemContent = async (
        item,
        doc,
        results,
        hasHorizontalRule,
      Severity: Minor
      Found in src/platform/pdf/templates/self_entered_info.js - About 2 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 generateTitleSection has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const generateTitleSection = (doc, parent, data) => {
        const titleSection = doc.struct('Sect', {
          title: 'Introduction',
        });
        parent.add(titleSection);
      Severity: Major
      Found in src/platform/pdf/templates/self_entered_info.js - About 2 hrs to fix

        Function generateResultsContent has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const generateResultsContent = async (doc, parent, data) => {
          const results = doc.struct('Sect', {
            title: 'Results',
          });
          parent.add(results);
        Severity: Major
        Found in src/platform/pdf/templates/self_entered_info.js - About 2 hrs to fix

          Function generate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const generate = async data => {
            validate(data);
            const doc = createAccessibleDoc(data, config);
          
            await registerVaGovFonts(doc);
          Severity: Major
          Found in src/platform/pdf/templates/self_entered_info.js - About 2 hrs to fix

            Function generateDetailsContentSets has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            const generateDetailsContentSets = async (doc, parent, data) => {
              const details = doc.struct('Sect', {
                title: 'Details',
              });
              parent.add(details);
            Severity: Minor
            Found in src/platform/pdf/templates/self_entered_info.js - About 1 hr 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 generateResultItemContent has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const generateResultItemContent = async (
              item,
              doc,
              results,
              hasHorizontalRule,
            Severity: Minor
            Found in src/platform/pdf/templates/self_entered_info.js - About 1 hr to fix

              Function generateResultsContent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              export const generateResultsContent = async (doc, parent, data) => {
                const results = doc.struct('Sect', {
                  title: 'Results',
                });
                parent.add(results);
              Severity: Minor
              Found in src/platform/pdf/templates/self_entered_info.js - About 55 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

              const generateResultItemContent = async (
                item,
                doc,
                results,
                hasHorizontalRule,
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 1 day to fix
              src/platform/pdf/templates/blue_button_report.js on lines 436..480

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

              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

              const generateDetailsContentSets = async (doc, parent, data) => {
                const details = doc.struct('Sect', {
                  title: 'Details',
                });
                parent.add(details);
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 1 day to fix
              src/platform/pdf/templates/blue_button_report.js on lines 382..412

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

              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

              const generateRecordSetIntroduction = async (doc, parent, recordSet) => {
                const headOptions = {
                  x: 20,
                  paragraphGap: recordSet.titleParagraphGap ?? 10,
                };
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 1 day to fix
              src/platform/pdf/templates/blue_button_report.js on lines 341..366

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

              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

              const generateDetailsContent = async (doc, parent, data) => {
                const details = doc.struct('Sect', {
                  title: 'Details',
                });
                parent.add(details);
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 1 day to fix
              src/platform/pdf/templates/blue_button_report.js on lines 414..434

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

              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

              const generateRecordTitle = (doc, parent, record) => {
                const title = doc.struct('Sect', {
                  title: `Header`,
                });
                parent.add(title);
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 5 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 368..380

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

              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

                if (data.results.items.length === 1) {
                  await generateResultItemContent(
                    data.results.items[0],
                    doc,
                    results,
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 2 other locations - About 4 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 533..560
              src/platform/pdf/templates/medical_records.js on lines 142..169

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

              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

                  if (Array.isArray(recordSet.records)) {
                    for (const record of recordSet.records) {
                      if (record.title) generateRecordTitle(doc, wrapper, record);
              
                      if (Array.isArray(record.details)) {
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 3 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 594..615

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

              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

                titleSection.add(
                  doc.struct('P', () => {
                    doc
                      .font(config.text.font)
                      .fontSize(config.text.size)
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 4 other locations - About 2 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 122..129
              src/platform/pdf/templates/blue_button_report.js on lines 130..137
              src/platform/pdf/templates/self_entered_info.js on lines 124..131
              src/platform/pdf/templates/self_entered_info.js on lines 140..147

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

              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

                titleSection.add(
                  doc.struct('P', () => {
                    doc
                      .font(config.text.font)
                      .fontSize(config.text.size)
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 4 other locations - About 2 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 122..129
              src/platform/pdf/templates/blue_button_report.js on lines 130..137
              src/platform/pdf/templates/self_entered_info.js on lines 132..139
              src/platform/pdf/templates/self_entered_info.js on lines 140..147

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

              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

                titleSection.add(
                  doc.struct('P', () => {
                    doc
                      .font(config.text.font)
                      .fontSize(config.text.size)
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 4 other locations - About 2 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 122..129
              src/platform/pdf/templates/blue_button_report.js on lines 130..137
              src/platform/pdf/templates/self_entered_info.js on lines 124..131
              src/platform/pdf/templates/self_entered_info.js on lines 132..139

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

              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

                headings: {
                  H1: {
                    font: 'Bitter-Bold',
                    size: 30,
                  },
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 2 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 31..52

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

              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

                if (data.results.header) {
                  const headingOptions = {
                    paragraphGap: 12,
                    x: data.results.headerIndent || 30,
                  };
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 2 hrs to fix
              src/platform/pdf/templates/blue_button_report.js on lines 487..501

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

              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

                titleSection.add(
                  doc.struct('P', () => {
                    doc
                      .font(config.text.font)
                      .fontSize(config.text.size)
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 2 hrs to fix
              src/platform/pdf/templates/self_entered_info.js on lines 111..123

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

              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

                titleSection.add(
                  doc.struct('P', () => {
                    doc
                      .font(config.text.font)
                      .fontSize(config.text.size)
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 2 hrs to fix
              src/platform/pdf/templates/self_entered_info.js on lines 98..110

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

              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

              const validate = data => {
                const requiredFields = [];
              
                const missingFields = requiredFields.filter(field => !data[field]);
                if (missingFields.length) {
              Severity: Major
              Found in src/platform/pdf/templates/self_entered_info.js and 1 other location - About 1 hr to fix
              src/platform/pdf/templates/blue_button_report.js on lines 332..339

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

              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