18F/web-design-standards

View on GitHub

Showing 301 of 368 total issues

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

    it("informs the user they are over the limit by a single character", () => {
      input.value = "123456789012345678901";

      EVENTS.input(input);

Severity: Major
Found in packages/usa-character-count/src/test/character-count.spec.js and 9 other locations - About 50 mins to fix
packages/usa-character-count/src/test/character-count.spec.js on lines 86..92
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 47..53
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 73..79
packages/usa-character-count/src/test/valid-template-no-maxlength.spec.js on lines 53..59
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 901..907
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 917..923
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1104..1110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should show a date that is before the minimum date as invalid", () => {
      input.value = "05/01/2020";

      EVENTS.keydownEnter(input);

packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 893..899
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1045..1050
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1052..1057
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1096..1102

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    afterEach(() => {
      DatePicker.off(containerSelector());
      DateRangePicker.off(containerSelector());
      body.textContent = "";
    });
packages/usa-date-range-picker/src/test/date-range-picker.spec.js on lines 44..48
packages/usa-date-range-picker/src/test/invalid-template-one-input.spec.js on lines 27..31
packages/usa-time-picker/src/test/time-picker.spec.js on lines 37..41

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should show a date that is the minimum date as valid", () => {
      input.value = "05/22/2020";

      EVENTS.keydownEnter(input);

packages/usa-character-count/src/test/character-count.spec.js on lines 86..92
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 102..111
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 47..53
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 73..79
packages/usa-character-count/src/test/valid-template-no-maxlength.spec.js on lines 53..59
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 901..907
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1104..1110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should show a date that is after the maximum date as invalid", () => {
      input.value = "06/30/2021";

      EVENTS.keydownEnter(input);

packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 909..915
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1045..1050
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1052..1057
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1096..1102

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("informs the user how many more characters they are allowed", () => {
      input.value = "1";

      EVENTS.input(input);

Severity: Major
Found in packages/usa-character-count/src/test/character-count.spec.js and 9 other locations - About 50 mins to fix
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 102..111
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 47..53
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 73..79
packages/usa-character-count/src/test/valid-template-no-maxlength.spec.js on lines 53..59
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 901..907
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 917..923
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1104..1110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    afterEach(() => {
      DatePicker.off(containerSelector());
      DateRangePicker.off(containerSelector());
      body.textContent = "";
    });
packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 44..48
packages/usa-date-range-picker/src/test/invalid-template-one-input.spec.js on lines 27..31
packages/usa-time-picker/src/test/time-picker.spec.js on lines 37..41

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  if (!isSameYear(currentDate, cappedDate)) {
    const newCalendar = displayYearSelection(
      calendarEl,
      cappedDate.getFullYear()
    );
Severity: Minor
Found in packages/usa-date-picker/src/index.js and 1 other location - About 50 mins to fix
packages/usa-date-picker/src/index.js on lines 1829..1835

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      it("should close the list by clicking away", () => {
        EVENTS.click(input);
        EVENTS.focusout(input);

        assert.ok(list.hidden, "should hide the option list");
Severity: Minor
Found in packages/usa-combo-box/src/test/combo-box.spec.js and 1 other location - About 50 mins to fix
packages/usa-combo-box/src/test/combo-box.spec.js on lines 137..142

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should not affect the validation message when the input is already invalid", () => {
      input.value = "abcde5";

      EVENTS.input(input);

packages/usa-character-count/src/test/character-count.spec.js on lines 86..92
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 102..111
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 47..53
packages/usa-character-count/src/test/valid-template-no-maxlength.spec.js on lines 53..59
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 901..907
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 917..923
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1104..1110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should show an improper date as invalid as the user leaves the input", () => {
      input.value = "abcdefg... That means the convo is done";
      EVENTS.focusout(input);

      assert.strictEqual(input.validationMessage, VALIDATION_MESSAGE);
Severity: Major
Found in packages/usa-date-picker/src/test/date-picker.spec.js and 4 other locations - About 50 mins to fix
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 893..899
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 909..915
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1052..1057
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1096..1102

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should show an improper date as invalid if the user presses enter from the input", () => {
      input.value = "2/31/2019";

      EVENTS.keydownEnter(input);

Severity: Major
Found in packages/usa-date-picker/src/test/date-picker.spec.js and 4 other locations - About 50 mins to fix
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 893..899
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 909..915
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1045..1050
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1052..1057

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    afterEach(() => {
      DatePicker.off(containerSelector());
      DateRangePicker.off(containerSelector());
      body.textContent = "";
    });
packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 44..48
packages/usa-date-range-picker/src/test/date-range-picker.spec.js on lines 44..48
packages/usa-time-picker/src/test/time-picker.spec.js on lines 37..41

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  if (!isSameMonth(currentDate, cappedDate)) {
    const newCalendar = displayMonthSelection(
      calendarEl,
      cappedDate.getMonth()
    );
Severity: Minor
Found in packages/usa-date-picker/src/index.js and 1 other location - About 50 mins to fix
packages/usa-date-picker/src/index.js on lines 1936..1942

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("assert that input constraint validation adds a validation message", () => {
      input.value = "abcd5";

      EVENTS.input(input);

packages/usa-character-count/src/test/character-count.spec.js on lines 86..92
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 102..111
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 73..79
packages/usa-character-count/src/test/valid-template-no-maxlength.spec.js on lines 53..59
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 901..907
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 917..923
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1104..1110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should show a date that is the maximum date as valid", () => {
      input.value = "06/20/2021";

      EVENTS.keydownEnter(input);

packages/usa-character-count/src/test/character-count.spec.js on lines 86..92
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 102..111
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 47..53
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 73..79
packages/usa-character-count/src/test/valid-template-no-maxlength.spec.js on lines 53..59
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 917..923
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1104..1110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should not inform the user of remaining characters when typing", () => {
      input.value = "1";

      EVENTS.input(input);

packages/usa-character-count/src/test/character-count.spec.js on lines 86..92
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 102..111
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 47..53
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 73..79
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 901..907
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 917..923
packages/usa-date-picker/src/test/date-picker.spec.js on lines 1104..1110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    afterEach(() => {
      ComboBox.off(containerSelector());
      TimePicker.off(containerSelector());
      body.textContent = "";
    });
Severity: Major
Found in packages/usa-time-picker/src/test/time-picker.spec.js and 3 other locations - About 50 mins to fix
packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 44..48
packages/usa-date-range-picker/src/test/date-range-picker.spec.js on lines 44..48
packages/usa-date-range-picker/src/test/invalid-template-one-input.spec.js on lines 27..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("should show an empty input as valid", () => {
      input.value = "";

      EVENTS.keydownEnter(input);

Severity: Major
Found in packages/usa-date-picker/src/test/date-picker.spec.js and 9 other locations - About 50 mins to fix
packages/usa-character-count/src/test/character-count.spec.js on lines 86..92
packages/usa-character-count/src/test/character-count.spec.js on lines 94..100
packages/usa-character-count/src/test/character-count.spec.js on lines 102..111
packages/usa-character-count/src/test/character-count.spec.js on lines 113..122
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 47..53
packages/usa-character-count/src/test/valid-template-multiple-validators.spec.js on lines 73..79
packages/usa-character-count/src/test/valid-template-no-maxlength.spec.js on lines 53..59
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 901..907
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 917..923

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      it("should toggle the list and close by clicking when clicking the toggle button twice", () => {
        EVENTS.click(toggle);
        EVENTS.click(toggle);

        assert.ok(list.hidden, "should hide the option list");
Severity: Minor
Found in packages/usa-combo-box/src/test/combo-box.spec.js and 1 other location - About 50 mins to fix
packages/usa-combo-box/src/test/combo-box.spec.js on lines 184..189

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language