Showing 545 of 2,098 total issues
Function parseValue
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
const parseValue = (mask, value) => {
// break the value up into mask parts
const valueParts = []; // { part, beginIndex, endIndex }
let valueIndex = 0;
let maskIndex = 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 Select
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
(
{
a11yTitle,
'aria-label': ariaLabel,
alignSelf,
- 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
File SelectMultiple-test.tsx
has 447 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState } from 'react';
import { act, render, screen, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { axe } from 'jest-axe';
import 'jest-axe/extend-expect';
Function getIconColor
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
const getIconColor = (paths = [], theme, colorProp, kind) => {
let result = [];
let index = paths.length - 1;
// caller has specified a themeObj to use for styling
// relevant for cases like pagination which looks to theme.pagination.button
- 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
File ToggleGroup-test.tsx
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import { axe } from 'jest-axe';
import userEvent from '@testing-library/user-event';
Function Bar
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
const Bar = forwardRef((props, ref) => {
const {
background,
max,
round,
- 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
File StyledBox.js
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
import styled, { css } from 'styled-components';
import { defaultProps } from '../../default-props';
import {
alignContentStyle,
Function formContextValue
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
const formContextValue = useMemo(() => {
const useFormInput = ({
name,
value: componentValue,
initialValue,
Function edgeStyle
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const edgeStyle = (
kind,
data,
responsive,
responsiveBreakpoint,
File MaskedInput.js
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {
forwardRef,
useCallback,
useContext,
useEffect,
File Header.js
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-underscore-dangle */
import React, {
forwardRef,
useCallback,
useContext,
File DataChart-test.tsx
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Fragment } from 'react';
import { render } from '@testing-library/react';
import 'jest-styled-components';
import { Grommet } from '../../Grommet';
Function List
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
(
{
a11yTitle,
'aria-label': ariaLabel,
action,
- 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 RichAccordion
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RichAccordion = () => {
const [highlightLoaded, setHighlightLoaded] = React.useState(false);
return (
<Grommet full theme={grommet}>
Function Diagram
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
const Diagram = forwardRef(({ connections, ...rest }, ref) => {
const theme = useContext(ThemeContext) || defaultProps.theme;
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
const [connectionPoints, setConnectionPoints] = useState();
const svgRef = useForwardedRef(ref);
- 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 Circle
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Circle = forwardRef((props, ref) => {
const { background, max, round, size, thickness, type, values, ...rest } =
props;
const theme = useContext(ThemeContext);
const width =
Function backgroundAndTextColors
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export const backgroundAndTextColors = (backgroundArg, textArg, theme) => {
if (!backgroundArg) return [undefined, textArg];
const { global } = theme;
const background = normalizeBackground(backgroundArg, theme);
- 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 roundStyle
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export const roundStyle = (data, responsive, theme) => {
const breakpoint = getBreakpointStyle(theme, theme.box.responsiveBreakpoint);
const styles = [];
if (typeof data === 'object') {
const size =
- 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 Swatch
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
const Swatch = ({
aspect,
color,
dash,
opacity: opacityProp,
- 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 MaskedInput
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
(
{
a11yTitle,
dropHeight,
dropProps,
- 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"