18F/web-design-standards

View on GitHub

Showing 368 of 368 total issues

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

    it("should allow selection of a month in the month selection screen that is partially disabled due to a minimum date being set", () => {
      input.value = "12/01/2020";
      EVENTS.click(button);
      EVENTS.click(
        getCalendarEl(".usa-date-picker__calendar__month-selection")
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 322..349

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

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 allow selection of a month in the month selection screen that is partially disabled due to a maximum date being set", () => {
      input.value = "01/30/2021";
      EVENTS.click(button);
      EVENTS.click(
        getCalendarEl(".usa-date-picker__calendar__month-selection")
packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 272..299

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

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

File index.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches");
const behavior = require("../../uswds-core/src/js/utils/behavior");
const Sanitizer = require("../../uswds-core/src/js/utils/sanitizer");
const { prefix: PREFIX } = require("../../uswds-core/src/js/config");

Severity: Minor
Found in packages/usa-file-input/src/index.js - About 4 hrs to fix

    Function displayYearSelection has 115 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const displayYearSelection = (el, yearToDisplay) => {
      const { calendarEl, statusEl, calendarDate, minDate, maxDate } =
        getDatePickerContext(el);
    
      const selectedYear = calendarDate.getFullYear();
    Severity: Major
    Found in packages/usa-date-picker/src/index.js - About 4 hrs to fix

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

            it("should close the list and reset input value when escape is performed while the list is open", () => {
              select.value = "cherry";
              input.value = "a";
      
              EVENTS.input(input);
      Severity: Major
      Found in packages/usa-combo-box/src/test/combo-box.spec.js and 1 other location - About 4 hrs to fix
      packages/usa-combo-box/src/test/combo-box.spec.js on lines 301..320

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

      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 set the input value when a complete selection is submitted by pressing enter", () => {
              select.value = "cranberry";
              input.value = "grape";
      
              EVENTS.input(input);
      Severity: Major
      Found in packages/usa-combo-box/src/test/combo-box.spec.js and 1 other location - About 4 hrs to fix
      packages/usa-combo-box/src/test/combo-box.spec.js on lines 267..286

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

      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 reset input values when an incomplete item is remaining on blur", () => {
              select.value = "apricot";
              input.value = "a";
              EVENTS.input(input);
              assert.ok(!list.hidden, "should display the option list");
      Severity: Major
      Found in packages/usa-combo-box/src/test/combo-box.spec.js and 1 other location - About 4 hrs to fix
      packages/usa-combo-box/src/test/combo-box.spec.js on lines 288..299

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

      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 reset the input value when a complete selection is left on blur from the input element", () => {
              select.value = "coconut";
              input.value = "date";
              EVENTS.input(input);
              assert.ok(!list.hidden, "should display the option list");
      Severity: Major
      Found in packages/usa-combo-box/src/test/combo-box.spec.js and 1 other location - About 4 hrs to fix
      packages/usa-combo-box/src/test/combo-box.spec.js on lines 223..234

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

      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 allow selection of a year in the year selection screen that is partially disabled due to a maximum date being set", () => {
            input.value = "12/01/2020";
            EVENTS.click(button);
            EVENTS.click(getCalendarEl(".usa-date-picker__calendar__year-selection"));
            assert.ok(
      packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 374..397

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

      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 allow selection of a year in the year selection screen that is partially disabled due to a minimum date being set", () => {
            input.value = "04/01/2021";
            EVENTS.click(button);
            EVENTS.click(getCalendarEl(".usa-date-picker__calendar__year-selection"));
            assert.ok(
      packages/usa-date-picker/src/test/date-picker-min-date-max-date.spec.js on lines 399..422

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

      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

          beforeEach(() => {
            body.innerHTML = TEMPLATE;
            DatePicker.on(containerSelector());
            DateRangePicker.on(containerSelector());
            root = dateRangePickerSelector();
      packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 29..42

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

      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

          beforeEach(() => {
            body.innerHTML = TEMPLATE;
            DatePicker.on(containerSelector());
            DateRangePicker.on(containerSelector());
            root = dateRangePickerSelector();
      packages/usa-date-range-picker/src/test/date-range-picker.spec.js on lines 29..42

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

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

      function toggleModal(event) {
        let originalOpener;
        let clickedElement = event.target;
        const { body } = document;
        const safeActive = !isActive();
      Severity: Minor
      Found in packages/usa-modal/src/index.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 enhanceComboBox has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const enhanceComboBox = (_comboBoxEl) => {
        const comboBoxEl = _comboBoxEl.closest(COMBO_BOX);
      
        if (comboBoxEl.dataset.enhanced) return;
      
      
      Severity: Major
      Found in packages/usa-combo-box/src/index.js - About 4 hrs to fix

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

            it("should update the range end date picker properties to have a min date and range date when the range start date picker has an updated valid value", () => {
              rangeStartInputEl.value = "12/12/2020";
        
              EVENTS.input(rangeStartInputEl);
        
        
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 128..149
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 151..172
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 174..199
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 201..222

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

        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 reset the range end date picker properties when the range start date picker has an updated invalid value", () => {
              rangeStartInputEl.value = "ab/dc/efg";
        
              EVENTS.input(rangeStartInputEl);
        
        
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 101..126
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 151..172
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 174..199
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 201..222

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

        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 not update the range end date picker properties when the range start date picker has an empty value", () => {
              rangeEndInputEl.value = "";
        
              EVENTS.input(rangeEndInputEl);
        
        
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 101..126
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 128..149
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 174..199
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 201..222

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

        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 update the range start date picker properties to have a max date and range date when the range end date picker has an updated valid value", () => {
              rangeEndInputEl.value = "12/11/2020";
        
              EVENTS.input(rangeEndInputEl);
        
        
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 101..126
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 128..149
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 151..172
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 201..222

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

        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 not update the range end date picker properties when the range start date picker has an updated invalid value", () => {
              rangeEndInputEl.value = "35/35/3535";
        
              EVENTS.input(rangeEndInputEl);
        
        
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 101..126
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 128..149
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 151..172
        packages/usa-date-range-picker/src/test/date-range-picker-min-date-max-date.spec.js on lines 174..199

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

        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 a Cognitive Complexity of 28 (exceeds 5 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: Minor
        Found in packages/usa-tooltip/src/index.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

        Severity
        Category
        Status
        Source
        Language