18F/web-design-standards

View on GitHub

Showing 368 of 368 total issues

Function renderCalendar has 208 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const renderCalendar = (el, _dateToDisplay) => {
  const {
    datePickerEl,
    calendarEl,
    statusEl,
Severity: Major
Found in packages/usa-date-picker/src/index.js - About 1 day to fix

    File combo-box.spec.js has 485 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const fs = require("fs");
    const path = require("path");
    const assert = require("assert");
    const ComboBox = require("../index");
    const EVENTS = require("./events");
    Severity: Minor
    Found in packages/usa-combo-box/src/test/combo-box.spec.js - About 7 hrs to fix

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

          it("should allow for navigation to the succeeding year by clicking the right double arrow button within the calendar", () => {
            input.value = "1/1/2020";
            EVENTS.click(button);
            assert.strictEqual(
              getCalendarEl().hidden,
      Severity: Major
      Found in packages/usa-date-picker/src/test/date-picker.spec.js and 3 other locations - About 6 hrs to fix
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 186..222
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 224..258
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 260..296

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

      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

          it("should allow for navigation to the preceding year by clicking the left double arrow button within the calendar", () => {
            input.value = "1/1/2016";
            EVENTS.click(button);
            assert.strictEqual(
              getCalendarEl().hidden,
      Severity: Major
      Found in packages/usa-date-picker/src/test/date-picker.spec.js and 3 other locations - About 6 hrs to fix
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 186..222
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 224..258
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 298..332

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

      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

          it("should allow for navigation to the preceding month by clicking the left single arrow button within the calendar", () => {
            input.value = "1/1/2020";
            EVENTS.click(button);
            assert.strictEqual(
              getCalendarEl().hidden,
      Severity: Major
      Found in packages/usa-date-picker/src/test/date-picker.spec.js and 3 other locations - About 6 hrs to fix
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 224..258
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 260..296
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 298..332

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

      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

          it("should allow for navigation to the succeeding month by clicking the right single arrow button within the calendar", () => {
            input.value = "1/1/2020";
            EVENTS.click(button);
            assert.strictEqual(
              getCalendarEl().hidden,
      Severity: Major
      Found in packages/usa-date-picker/src/test/date-picker.spec.js and 3 other locations - About 6 hrs to fix
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 186..222
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 260..296
      packages/usa-date-picker/src/test/date-picker.spec.js on lines 298..332

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

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

      const showToolTip = (tooltipBody, tooltipTrigger, position) => {
        tooltipBody.setAttribute("aria-hidden", "false");
      
        // This sets up the tooltip body. The opacity is 0, but
        // we can begin running the calculations below.
      Severity: Major
      Found in packages/usa-tooltip/src/index.js - About 6 hrs to fix

        Function renderCalendar has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

        const renderCalendar = (el, _dateToDisplay) => {
          const {
            datePickerEl,
            calendarEl,
            statusEl,
        Severity: Minor
        Found in packages/usa-date-picker/src/index.js - About 6 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

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

            it("should disable back buttons when displaying the minimum month", () => {
              input.value = "05/30/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 102..131

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

        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

            it("should disable forward buttons when displaying the maximum month", () => {
              input.value = "06/01/2021";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 71..100

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

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

        const parseDateString = (
          dateString,
          dateFormat = INTERNAL_DATE_FORMAT,
          adjustDate = false
        ) => {
        Severity: Minor
        Found in packages/usa-date-picker/src/index.js - About 5 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

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

            it("should move focus to the next day when right is pressed from the currently focused day", () => {
              input.value = "1/10/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to the same day of the next month when page down is pressed from the currently focused day", () => {
              input.value = "1/1/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to the same day of week of the previous week when up is pressed from the currently focused day", () => {
              input.value = "1/10/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to the last day of the next month when page down is pressed from the the last day of a longer month", () => {
              input.value = "1/31/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to the same day/month of the next year when shift + page down is pressed from the currently focused day", () => {
              input.value = "1/1/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to the same day of week of the next week when down is pressed from the currently focused day", () => {
              input.value = "1/10/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to the previous day when left is pressed from the currently focused day", () => {
              input.value = "1/10/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to the last day of the previous month when page up is pressed from the the last day of a longer month", () => {
              input.value = "12/31/2019";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 979..1011

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

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

            it("should move focus to February 28th of the next year when shift + page down is pressed from a focused February 29th date of a leap year", () => {
              input.value = "2/29/2020";
              EVENTS.click(button);
              assert.strictEqual(
                getCalendarEl().hidden,
        Severity: Major
        Found in packages/usa-date-picker/src/test/date-picker.spec.js and 14 other locations - About 5 hrs to fix
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 503..535
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 537..569
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 571..603
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 605..637
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 639..671
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 673..705
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 707..739
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 741..773
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 775..807
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 809..841
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 843..875
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 877..909
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 911..943
        packages/usa-date-picker/src/test/date-picker.spec.js on lines 945..977

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

        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

        Severity
        Category
        Status
        Source
        Language