18F/web-design-standards

View on GitHub
packages/usa-date-picker/src/index.js

Summary

Maintainability
F
2 wks
Test Coverage

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

const keymap = require("receptor/keymap");
const behavior = require("../../uswds-core/src/js/utils/behavior");
const select = require("../../uswds-core/src/js/utils/select");
const selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches");
const { prefix: PREFIX } = require("../../uswds-core/src/js/config");
Severity: Major
Found in packages/usa-date-picker/src/index.js - About 3 days to fix

    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

      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

      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

      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

        Function generateDateHtml has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const generateDateHtml = (dateToRender) => {
            const classes = [CALENDAR_DATE_CLASS];
            const day = dateToRender.getDate();
            const month = dateToRender.getMonth();
            const year = dateToRender.getFullYear();
        Severity: Major
        Found in packages/usa-date-picker/src/index.js - About 2 hrs to fix

          Function parseDateString has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const parseDateString = (
            dateString,
            dateFormat = INTERNAL_DATE_FORMAT,
            adjustDate = false
          ) => {
          Severity: Major
          Found in packages/usa-date-picker/src/index.js - About 2 hrs to fix

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

            const enhanceDatePicker = (el) => {
              const datePickerEl = el.closest(DATE_PICKER);
              const { defaultValue } = datePickerEl.dataset;
            
              const internalInputEl = datePickerEl.querySelector(`input`);
            Severity: Major
            Found in packages/usa-date-picker/src/index.js - About 2 hrs to fix

              Function displayMonthSelection has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const displayMonthSelection = (el, monthToDisplay) => {
                const { calendarEl, statusEl, calendarDate, minDate, maxDate } =
                  getDatePickerContext(el);
              
                const selectedMonth = calendarDate.getMonth();
              Severity: Minor
              Found in packages/usa-date-picker/src/index.js - About 1 hr to fix

                Function getDatePickerContext has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const getDatePickerContext = (el) => {
                  const datePickerEl = el.closest(DATE_PICKER);
                
                  if (!datePickerEl) {
                    throw new Error(`Element is missing outer ${DATE_PICKER}`);
                Severity: Minor
                Found in packages/usa-date-picker/src/index.js - About 1 hr to fix

                  Function tabHandler has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const tabHandler = (focusable) => {
                    const getFocusableContext = (el) => {
                      const { calendarEl } = getDatePickerContext(el);
                      const focusableElements = select(focusable, calendarEl);
                  
                  
                  Severity: Minor
                  Found in packages/usa-date-picker/src/index.js - About 1 hr to fix

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

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

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function months has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const months = MONTH_LABELS.map((month, index) => {
                        const monthToCheck = setMonth(calendarDate, index);
                    
                        const isDisabled = isDatesMonthOutsideMinOrMax(
                          monthToCheck,
                    Severity: Minor
                    Found in packages/usa-date-picker/src/index.js - About 1 hr to fix

                      Function isDateInputInvalid has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const isDateInputInvalid = (el) => {
                        const { externalInputEl, minDate, maxDate } = getDatePickerContext(el);
                      
                        const dateString = externalInputEl.value;
                        let isInvalid = false;
                      Severity: Minor
                      Found in packages/usa-date-picker/src/index.js - About 1 hr to fix

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

                        const displayMonthSelection = (el, monthToDisplay) => {
                          const { calendarEl, statusEl, calendarDate, minDate, maxDate } =
                            getDatePickerContext(el);
                        
                          const selectedMonth = calendarDate.getMonth();
                        Severity: Minor
                        Found in packages/usa-date-picker/src/index.js - About 55 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function enhanceDatePicker has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const enhanceDatePicker = (el) => {
                          const datePickerEl = el.closest(DATE_PICKER);
                          const { defaultValue } = datePickerEl.dataset;
                        
                          const internalInputEl = datePickerEl.querySelector(`input`);
                        Severity: Minor
                        Found in packages/usa-date-picker/src/index.js - About 45 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Avoid deeply nested control flow statements.
                        Open

                                  if (yearStr.length < 3) {
                                    const currentYear = today().getFullYear();
                                    const currentYearStub =
                                      currentYear - (currentYear % 10 ** yearStr.length);
                                    year = currentYearStub + parsed;
                        Severity: Major
                        Found in packages/usa-date-picker/src/index.js - About 45 mins to fix

                          Function isDateInputInvalid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const isDateInputInvalid = (el) => {
                            const { externalInputEl, minDate, maxDate } = getDatePickerContext(el);
                          
                            const dateString = externalInputEl.value;
                            let isInvalid = false;
                          Severity: Minor
                          Found in packages/usa-date-picker/src/index.js - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

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

                          const displayNextYearChunk = (el) => {
                            if (el.disabled) return;
                          
                            const { calendarEl, calendarDate, minDate, maxDate } =
                              getDatePickerContext(el);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 day to fix
                          packages/usa-date-picker/src/index.js on lines 1604..1627

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

                          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

                          const displayPreviousYearChunk = (el) => {
                            if (el.disabled) return;
                          
                            const { calendarEl, calendarDate, minDate, maxDate } =
                              getDatePickerContext(el);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 day to fix
                          packages/usa-date-picker/src/index.js on lines 1634..1657

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

                          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

                          const displayNextYear = (_buttonEl) => {
                            if (_buttonEl.disabled) return;
                            const { calendarEl, calendarDate, minDate, maxDate } =
                              getDatePickerContext(_buttonEl);
                            let date = addYears(calendarDate, 1);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 3 other locations - About 5 hrs to fix
                          packages/usa-date-picker/src/index.js on lines 1187..1200
                          packages/usa-date-picker/src/index.js on lines 1207..1220
                          packages/usa-date-picker/src/index.js on lines 1227..1240

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

                          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

                          const displayPreviousYear = (_buttonEl) => {
                            if (_buttonEl.disabled) return;
                            const { calendarEl, calendarDate, minDate, maxDate } =
                              getDatePickerContext(_buttonEl);
                            let date = subYears(calendarDate, 1);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 3 other locations - About 5 hrs to fix
                          packages/usa-date-picker/src/index.js on lines 1207..1220
                          packages/usa-date-picker/src/index.js on lines 1227..1240
                          packages/usa-date-picker/src/index.js on lines 1247..1260

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

                          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

                          const displayPreviousMonth = (_buttonEl) => {
                            if (_buttonEl.disabled) return;
                            const { calendarEl, calendarDate, minDate, maxDate } =
                              getDatePickerContext(_buttonEl);
                            let date = subMonths(calendarDate, 1);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 3 other locations - About 5 hrs to fix
                          packages/usa-date-picker/src/index.js on lines 1187..1200
                          packages/usa-date-picker/src/index.js on lines 1227..1240
                          packages/usa-date-picker/src/index.js on lines 1247..1260

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

                          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

                          const displayNextMonth = (_buttonEl) => {
                            if (_buttonEl.disabled) return;
                            const { calendarEl, calendarDate, minDate, maxDate } =
                              getDatePickerContext(_buttonEl);
                            let date = addMonths(calendarDate, 1);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 3 other locations - About 5 hrs to fix
                          packages/usa-date-picker/src/index.js on lines 1187..1200
                          packages/usa-date-picker/src/index.js on lines 1207..1220
                          packages/usa-date-picker/src/index.js on lines 1247..1260

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

                          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

                          const handleMouseoverFromMonth = (monthEl) => {
                            if (monthEl.disabled) return;
                            if (monthEl.classList.contains(CALENDAR_MONTH_FOCUSED_CLASS)) return;
                          
                            const focusMonth = parseInt(monthEl.dataset.value, 10);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 2 hrs to fix
                          packages/usa-date-picker/src/index.js on lines 2016..2024

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 88.

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

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

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

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

                          Refactorings

                          Further Reading

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

                          const handleMouseoverFromYear = (yearEl) => {
                            if (yearEl.disabled) return;
                            if (yearEl.classList.contains(CALENDAR_YEAR_FOCUSED_CLASS)) return;
                          
                            const focusYear = parseInt(yearEl.dataset.value, 10);
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 2 hrs to fix
                          packages/usa-date-picker/src/index.js on lines 1905..1913

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 88.

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

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

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

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

                          Refactorings

                          Further Reading

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

                          const changeElementValue = (el, value = "") => {
                            const elementToChange = el;
                            elementToChange.value = value;
                          
                            const event = new CustomEvent("change", {
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 2 hrs to fix
                          packages/usa-combo-box/src/index.js on lines 44..54

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 86.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              tabAhead(event) {
                                const { firstTabStop, isLastTab, isNotFound } = getFocusableContext(
                                  event.target
                                );
                          
                          
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 2066..2075

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

                          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

                              tabBack(event) {
                                const { lastTabStop, isFirstTab, isNotFound } = getFocusableContext(
                                  event.target
                                );
                          
                          
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 2056..2065

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

                          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

                              [CALENDAR_MONTH]: keymap({
                                Up: handleUpFromMonth,
                                ArrowUp: handleUpFromMonth,
                                Down: handleDownFromMonth,
                                ArrowDown: handleDownFromMonth,
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 2181..2194

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

                          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

                              [CALENDAR_YEAR]: keymap({
                                Up: handleUpFromYear,
                                ArrowUp: handleUpFromYear,
                                Down: handleDownFromYear,
                                ArrowDown: handleDownFromYear,
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 2163..2176

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

                          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

                          const max = (dateA, dateB) => {
                            let newDate = dateA;
                          
                            if (dateB > dateA) {
                              newDate = dateB;
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 356..364

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

                          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

                          const min = (dateA, dateB) => {
                            let newDate = dateA;
                          
                            if (dateB < dateA) {
                              newDate = dateB;
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 373..381

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

                          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

                          const enable = (el) => {
                            const { externalInputEl, toggleBtnEl } = getDatePickerContext(el);
                          
                            toggleBtnEl.disabled = false;
                            externalInputEl.disabled = false;
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 709..714

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

                          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

                          const disable = (el) => {
                            const { externalInputEl, toggleBtnEl } = getDatePickerContext(el);
                          
                            toggleBtnEl.disabled = true;
                            externalInputEl.disabled = true;
                          Severity: Major
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 1 hr to fix
                          packages/usa-date-picker/src/index.js on lines 733..738

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

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

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

                              const [month, day, year] = dateStringParts.map((str) => {
                                let value;
                                const parsed = parseInt(str, 10);
                                if (!Number.isNaN(parsed)) value = parsed;
                                return value;
                          Severity: Minor
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 40 mins to fix
                          packages/usa-time-picker/src/index.js on lines 34..39

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

                          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

                            const {
                              datePickerEl,
                              calendarEl,
                              statusEl,
                              selectedDate,
                          Severity: Minor
                          Found in packages/usa-date-picker/src/index.js and 1 other location - About 35 mins to fix
                          packages/usa-combo-box/src/index.js on lines 373..381

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

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

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

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

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

                          Refactorings

                          Further Reading

                          There are no issues that match your filters.

                          Category
                          Status