Showing 64 of 262 total issues
Function DropdownList
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const DropdownList = ({ selectProps, ...props }: any) => {
if (selectProps?.enableTermSearch) {
const select = selectProps?.selectRef?.current?.select;
const selectValueSync = select?.state?.selectValue;
const selectValueAsync = select?.state?.value?.searchHeader;
- 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 handleKeyDown
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const handleKeyDown = (
event,
setInputValue,
options,
steps,
- 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 SelectionInput
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const SelectionInput: React.FC<SelectionInputPropsWithType> = ({
id,
type,
name,
label,
- 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 moveFocusOnNextField
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const moveFocusOnNextField = (event, setInputValue, format) => {
const isValidCharacter = /^[0-9aAmMpP]$/i.test(event.key);
const cursorPosition = event.target.selectionStart;
let inputValue = event.target.value;
if (isValidCharacter) {
- 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
Avoid deeply nested control flow statements. Open
if (enabledCell) {
enabledCell.focus();
} else {
// if all cell are disabled, focus the first day of month
this.focusCell(
Function getChildWithValidation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private getChildWithValidation(child) {
if (!React.isValidElement(child)) {
console.error('Child is not a valid React element', child);
}
return React.cloneElement(child as any, {
- 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 handleClickOutside
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private handleClickOutside(event) {
const { popperElement, refContainer, showPicker } = this.state;
if (
refContainer &&
!refContainer.contains(event.target) &&
- 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 LabelTooltipDecorator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const LabelTooltipDecorator: React.FC<LabelTooltipDecoratorProps> = ({
id,
htmlFor,
label,
placement,
- 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 Modal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const Modal: React.FC<ModalProps> = ({
size,
className,
children,
closeButton,
- 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 componentDidUpdate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate(prevProps: ResizeDetectDivProps) {
const { width, height } = this.props;
const widthChanged = width - prevProps.width;
const heightChanged = height - prevProps.height;
if (widthChanged && this.props.onWidthChange) {
- 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
Avoid too many return
statements within this function. Open
return { disabledTime: 'This time is not available' };
Avoid too many return
statements within this function. Open
return { disabledDate: 'This date is not available' };
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Function callParentAndChildMethod
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const callParentAndChildMethod = (parent, child, methodName) => (
...args
) => {
parent && methodName && parent[methodName]
? parent[methodName](...args)
- 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 getISOTimeFromLocalTime
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getISOTimeFromLocalTime = (
time: string,
format: string = TIME_FORMAT.HH_MM_SS_24
): Time => {
if (!time || !format || !getTimeFromString(time)) {
- 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 handleKeyDownFooter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
handleKeyDownFooter(e): void {
switch (e.key) {
case Keys.TAB:
if (!e.shiftKey) {
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 DropdownMenu
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const DropdownMenu: React.FC<DropdownMenuProps> = ({children, className, show = true, onClose, ...rest}: DropdownMenuProps) => {
const classes = clsx(
'tk-dropdown-menu',
className,
)
- 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 getSiblingOrCurrent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getSiblingOrCurrent(elem, selector: string, direction: 'nextElementSibling' | 'previousElementSibling', maxStepToCheck: number) {
let sibling = elem; // get current first
// If there's no selector, return the first sibling
if (!selector) return sibling;
- 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 computeError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private computeError(date): ErrorMessages {
const { disabledDays } = this.props;
if (!date) {
return null;
- 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"