Showing 545 of 2,098 total issues
Consider simplifying this complex logical expression. Open
} else if (
focus &&
formFieldTheme.focus &&
formFieldTheme.focus.border &&
formFieldTheme.focus.border.color
Consider simplifying this complex logical expression. Open
if (
responsive &&
((align.top === 'top' && targetRect.top < 0) ||
(align.bottom === 'top' &&
targetRect.top - containerRect.height <= 0 &&
Consider simplifying this complex logical expression. Open
if (replace || renderPageBounds[1] < lastPage || onMore) {
let marker = (
<Box
key="below"
ref={(!renderMarker && belowMarkerRef) || undefined}
Consider simplifying this complex logical expression. Open
} else if (
// backward compatibility check
(error && themeBorder && themeBorder.error.color) ||
(error && formFieldTheme.error && formFieldTheme.error.border)
) {
Consider simplifying this complex logical expression. Open
if (
(border === 'between' ||
(border && border.side === 'between') ||
(Array.isArray(border) && border.find((b) => b.side === 'between'))) &&
!gap
Consider simplifying this complex logical expression. Open
} else if (
responsive &&
((align.bottom === 'bottom' && targetRect.bottom > windowHeight) ||
(align.top === 'bottom' &&
targetRect.bottom + containerRect.height >= windowHeight &&
Consider simplifying this complex logical expression. Open
if (fromElement && toElement) {
const fromRect = fromElement.getBoundingClientRect();
const toRect = toElement.getBoundingClientRect();
// There is no x and y when unit testing.
const fromPoint = [
Consider simplifying this complex logical expression. Open
if (
props.active &&
props.primary &&
props.theme.button.primary &&
props.theme.button.primary.active &&
Consider simplifying this complex logical expression. Open
if (sortSelectedOnClose && value && !open) {
const selectedOptions = optionsProp.filter((option) =>
arrayIncludes(
value,
valueKey && valueKey.reduce ? applyKey(option, valueKey) : option,
Function normalizeBackgroundImage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const normalizeBackgroundImage = (background, theme) => {
let result;
if (background.image) {
result =
normalizeBackground(
- 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 getHoverIndicatorStyle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getHoverIndicatorStyle = (hoverIndicator, theme) => {
let background;
let elevation;
if (hoverIndicator === true || hoverIndicator === 'background') {
({ background } = theme.global.hover);
- 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 sortCompare
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const sortCompare = (a, b, sort) => {
const v1 = a[sort.property] || '';
const v2 = b[sort.property] || '';
const dir = sort.direction || 'asc';
let result = 0;
- 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 Indeterminate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const Indeterminate = () => {
const [checked, setChecked] = useState([]);
const checkboxes = ['fruits', 'vegetables', 'olive oil'];
const onCheckAll = (event) => {
- 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 defaultColor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const defaultColor = (index, theme, valuesLength) => {
if (index === valuesLength - 1 && theme.meter.color) {
return theme.meter.color;
}
// We want the last value to have the first color
- 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 normalizeValues
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const normalizeValues = (values) =>
(values || []).map((value, index) => {
if (value === undefined) return { value: [index, undefined] };
if (Array.isArray(value)) return { value };
if (typeof value === 'object') return 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 kindStyle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const kindStyle = ({
busy,
colorValue,
hasIcon,
hasLabel,
- 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 TagInput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const TagInput = ({ value = [], onAdd, onChange, onRemove, ...rest }) => {
const [currentTag, setCurrentTag] = React.useState('');
const boxRef = React.useRef();
const updateCurrentTag = (event) => {
- 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 validateBounds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const validateBounds = (dateBounds, selectedDate) => {
if (!dateBounds || !selectedDate) return selectedDate;
const [startDate, endDate] = dateBounds.map((date) =>
setHoursWithOffset(date).toISOString(),
- 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 ''; // defensive
Avoid too many return
statements within this function. Open
return 'forwards';