Showing 545 of 2,098 total issues
Function normalizeBackground
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const normalizeBackground = (backgroundArg, theme) => {
const background = theme.global.backgrounds?.[backgroundArg] || backgroundArg;
let result = background;
// If the background has a light or dark object, use that
if (background) {
- 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 sizeStyle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const sizeStyle = (props) => {
const style =
props.theme.pagination.button &&
props.theme.pagination.button.size &&
props.theme.pagination.button.size[props.size || 'medium'];
- 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 decorators
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(Story, context) => {
const [rootRef, setRootRef] = useState(null);
const [state, setState] = useState('grommet');
const [root, setRoot] = useState('document');
const full = context.allArgs?.full || 'min';
- 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 Searcher
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Searcher = ({ filtering, filters, onFilter, onFiltering, property }) => {
const theme = useContext(ThemeContext) || defaultProps.theme;
const inputRef = useRef();
const needsFocus = filtering === property;
- 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 usePagination
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const usePagination = ({ data, page, step, ...rest }) => {
const totalPages = data ? Math.ceil(data.length / step) : 0;
const [activePage, setActivePage] = useState(Math.min(page, totalPages) || 1);
// ensure activePage is never lower than 1 to ensure that itemsBeginIndex
- 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 sizeStyle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const sizeStyle = (props) => {
if (props.size) {
const size = props.size || 'medium';
const data = props.theme.text[size];
return css`
- 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 ControlledDataTable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const ControlledDataTable = () => {
const [checked, setChecked] = React.useState([]);
const onCheck = (event, value) => {
if (event.target.checked) {
- 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 withinDropPortal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const withinDropPortal = (node, portalContext) => {
const root = node?.getRootNode();
let element = node;
let portalId;
while (element && element !== root) {
- 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 animationObjectStyle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const animationObjectStyle = (animation, theme, themeObj) => {
const bounds = animationBounds(animation.type, animation.size);
const animationTheme =
(themeObj && themeObj.animation) || theme.global.animation;
- 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 getRGBArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getRGBArray = (color) => {
if (hexExp.test(color)) {
const [red, green, blue, alpha] = parseHexToRGB(color);
return [red, green, blue, alpha !== undefined ? alpha / 255.0 : undefined];
}
- 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 Sorter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Sorter = ({
align,
children,
fill,
onSort,
- 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 ArrayOfFormFields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const ArrayOfFormFields = () => {
const [values, setValues] = useState({
name: '',
phones: [{ number: '', ext: '' }],
});
- 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 getNormalizedValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getNormalizedValue = (value, valueKey) => {
if (Array.isArray(value))
return value.map((v) =>
valueKey && valueKey.reduce ? v : applyKey(v, valueKey),
);
- 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 normalizeOutput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const normalizeOutput = (dateValue, outputFormat) => {
let result;
const normalize = (value) => {
let normalizedValue = value.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
Function setValueAt
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const setValueAt = (valueObject, pathArg, value) => {
const object = valueObject;
const path = Array.isArray(pathArg) ? pathArg : pathArg.split('.');
if (path.length === 1) object[path] = value;
else {
- 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 reorder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const reorder = (array, pinnedArray, source, target) => {
const result = array.slice(0);
const tmp = result[source];
if (source < target)
for (let i = source; i < target; i += 1) result[i] = result[i + 1];
- 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 getAnimationStyle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getAnimationStyle = (props, position, full) => {
let animation =
props.animation !== undefined ? props.animation : props.animate;
if (animation === undefined) animation = 'slide';
let keys;
- 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 AnimatedBox
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
${(props) =>
props.shouldOpen
? `visibility: hidden;
position: absolute;
pointer-events: none;`
- 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 LazyDrop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const LazyDrop = () => {
const [pad, setPad] = useState(null);
const topLeftTargetRef = useRef();
const topRightTargetRef = useRef();
- 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 DropContainer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(
{
a11yTitle,
'aria-label': ariaLabel,
align = defaultAlign,
- 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"