Showing 67 of 368 total issues
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");
File date-picker.spec.js
has 1001 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require("fs");
const path = require("path");
const assert = require("assert");
const DatePicker = require("../index");
const EVENTS = require("./events");
File date-picker-min-date-max-date.spec.js
has 856 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require("fs");
const path = require("path");
const assert = require("assert");
const EVENTS = require("./events");
const DatePicker = require("../index");
File index.js
has 563 lines of code (exceeds 250 allowed). Consider refactoring. Open
const keymap = require("receptor/keymap");
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");
Function renderCalendar
has 208 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderCalendar = (el, _dateToDisplay) => {
const {
datePickerEl,
calendarEl,
statusEl,
File combo-box.spec.js
has 485 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require("fs");
const path = require("path");
const assert = require("assert");
const ComboBox = require("../index");
const EVENTS = require("./events");
Function showToolTip
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
const showToolTip = (tooltipBody, tooltipTrigger, position) => {
tooltipBody.setAttribute("aria-hidden", "false");
// This sets up the tooltip body. The opacity is 0, but
// we can begin running the calculations below.
Function renderCalendar
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
const renderCalendar = (el, _dateToDisplay) => {
const {
datePickerEl,
calendarEl,
statusEl,
- Read upRead up
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
) => {
- Read upRead up
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
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");
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();
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();
- Read upRead up
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;
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.
- Read upRead up
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 displayList
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
const displayList = (el) => {
const {
comboBoxEl,
selectEl,
inputEl,
Function displayList
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
const displayList = (el) => {
const {
comboBoxEl,
selectEl,
inputEl,
- Read upRead up
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 toggleModal
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
function toggleModal(event) {
let originalOpener;
let clickedElement = event.target;
const { body } = document;
const safeActive = !isActive();
Function svg4everybody
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function svg4everybody(rawopts) {
function oninterval() {
// if all <use>s in the array are being bypassed, don't proceed.
if (
numberOfSvgUseElementsToBypass &&
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();
Function handleChange
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleChange = (e, fileInputEl, instructions, dropTarget) => {
const fileNames = e.target.files;
const inputParent = dropTarget.closest(`.${DROPZONE_CLASS}`);
const statusElement = inputParent.querySelector(`.${SR_ONLY_CLASS}`);
const fileStore = [];