Showing 67 of 368 total issues
Function createInPageNav
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createInPageNav = (inPageNavEl) => {
const inPageNavTitleText = Sanitizer.escapeHTML`${
inPageNavEl.dataset.titleText || IN_PAGE_NAV_TITLE_TEXT
}`;
const inPageNavTitleHeadingLevel = Sanitizer.escapeHTML`${
Function preventInvalidFiles
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const preventInvalidFiles = (e, fileInputEl, instructions, dropTarget) => {
const acceptedFilesAttr = fileInputEl.getAttribute("accept");
dropTarget.classList.remove(INVALID_FILE_CLASS);
/**
- 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 transformTimePicker
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const transformTimePicker = (el) => {
const timePickerEl = el.closest(TIME_PICKER);
const initialInputEl = timePickerEl.querySelector(`input`);
Function parseDateString
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parseDateString = (
dateString,
dateFormat = INTERNAL_DATE_FORMAT,
adjustDate = false
) => {
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`);
File usa-icons.config.js
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
const config = {
material: [
"accessibility_new",
"accessible_forward",
"account_balance",
Function oninterval
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function oninterval() {
// if all <use>s in the array are being bypassed, don't proceed.
if (
numberOfSvgUseElementsToBypass &&
uses.length - numberOfSvgUseElementsToBypass <= 0
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();
Function handleCurrentValue
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const handleCurrentValue = (el) => {
const isCharsetPresent = el.dataset.charset;
const placeholder = isCharsetPresent || el.dataset.placeholder;
const { value } = el;
const len = placeholder.length;
- 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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const enhanceComboBox = (_comboBoxEl) => {
const comboBoxEl = _comboBoxEl.closest(COMBO_BOX);
if (comboBoxEl.dataset.enhanced) return;
- 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 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}`);
Function preventInvalidFiles
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const preventInvalidFiles = (e, fileInputEl, instructions, dropTarget) => {
const acceptedFilesAttr = fileInputEl.getAttribute("accept");
dropTarget.classList.remove(INVALID_FILE_CLASS);
/**
Function validate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function validate(el) {
const id = el.dataset.validationElement;
const checkList =
id.charAt(0) === "#"
? document.querySelector(id)
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);
Function highlightOption
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const highlightOption = (el, nextEl, { skipFocus, preventScroll } = {}) => {
const { inputEl, listEl, focusedOptionEl } = getComboBoxContext(el);
if (focusedOptionEl) {
focusedOptionEl.classList.remove(LIST_OPTION_FOCUSED_CLASS);
- 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 resetSelection
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const resetSelection = (el) => {
const { comboBoxEl, selectEl, inputEl } = getComboBoxContext(el);
const selectValue = selectEl.value;
const inputValue = (inputEl.value || "").toLowerCase();
- 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 handleChange
has a Cognitive Complexity of 12 (exceeds 5 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 = [];
- 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 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();
- 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 createFilePreview
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
reader.onloadend = function createFilePreview() {
const previewImage = document.getElementById(imageId);
if (fileName.indexOf(".pdf") > 0) {
previewImage.setAttribute(
"onerror",
Function buildFileObj
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildFileObj(dir, file, dataFile){
const templateFile = file
const dataFilePath = `${dir}/${dataFile}`
const name = !dataFile
? `${file.substr(file.lastIndexOf('/') + 1).replace('.twig', '.html')}`