Showing 64 of 262 total issues
File DatePicker.tsx
has 519 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as PropTypes from 'prop-types';
import * as React from 'react';
import { createPortal } from 'react-dom';
import { Component, createRef } from 'react';
import { clsx } from 'clsx';
File DayPicker.tsx
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as PropTypes from 'prop-types';
import * as React from 'react';
import { clsx } from 'clsx';
import { Modifier } from '../model/Modifiers';
Function render
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
hideSelectedOptions,
closeMenuOnSelect,
displayArrowIndicator,
File TimePicker.tsx
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Dropdown } from '../dropdown';
import * as React from 'react';
import { useEffect, useMemo, useState } from 'react';
import { Keys } from '../common/eventUtils';
import { ErrorMessages } from '../validation/interfaces';
Function debounce
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
export function debounce(func: any, wait?: any, options?: any): any {
let lastArgs,
lastThis,
maxWait,
result,
- 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 debounce
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function debounce(func: any, wait?: any, options?: any): any {
let lastArgs,
lastThis,
maxWait,
result,
File Dropdown.tsx
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as React from 'react';
import { CSSProperties } from 'react';
import Select, { ActionMeta, createFilter } from 'react-select';
import CreatableSelect from 'react-select/creatable';
import AsyncSelect from 'react-select/async';
Function renderBody
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderBody() {
const {
dir,
locale,
selectedDays,
File timeUtils.tsx
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { format as formatTime, parse as parseTime, isValid } from 'date-fns';
import Time from './Time';
import { DisabledTime, TimePickerOption } from '../interfaces';
Function handleKeyDownCell
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleKeyDownCell(e: React.KeyboardEvent, date: Date, modifers): void {
const { locale, dir } = this.props;
const { currentMonth } = this.state;
if (e.key !== Keys.ESC) {
cancelEvent(e);
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
id,
disabled,
format,
Function Header
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const Header: FunctionComponent<HeaderProps> = ({ date, dir, labels, months, onChange, parentRef }) => {
const changeYear = (amount: number) => {
onChange(addYears(date, amount));
};
- 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 handleKeyDownCell
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
handleKeyDownCell(e: React.KeyboardEvent, date: Date, modifers): void {
const { locale, dir } = this.props;
const { currentMonth } = this.state;
if (e.key !== Keys.ESC) {
cancelEvent(e);
- 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 getNextSelectionIndexes
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export const getNextSelectionIndexes = (
value: string,
cursorPosition: number,
searchForward = true
): { start: number; end: number } => {
- 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
DatePicker
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class DatePicker extends Component<
DatePickerComponentProps,
DatePickerComponentState
> {
static defaultProps = {
Function focusOnlyEnabledCell
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
focusOnlyEnabledCell(
date: Date,
action: 'next' | 'previous',
maxStepCheck: number,
needToChangeMonth = true
- 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 updateState
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async updateState(value: string): Promise<string[]> {
let errorsMap = {};
let valid = true;
let errors = [];
let validationResults;
Function toNumber
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
- 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 renderCalendar
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderCalendar() {
const {
date,
disabledDays,
dir,
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { children, validator } = this.props;
let childWithValidation;
if (React.Children.count(children) === 0) {