Showing 14 of 49 total issues
Function expandCSS
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export const expandCSS = ({ d, gap, gapX, gapY, ...rest }: ThemeBoxProps) => {
let styles: CSSObject = {}
if (d) {
styles = { ...styles, display: d }
if (d === 'flex' || d === 'inline-flex') {
- 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 generateButtonConfig
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
(componentProps, theme) => {
const defaultButtonThemeOptions = getDefaultButtonThemeOptions(theme.spacing)
const themeOptions = deepMerge(defaultButtonThemeOptions, buttonThemeOptions)
const assignedProps = deepMerge(themeOptions.default, componentProps)
const { size, rounded, color, variant } = assignedProps
File colors.ts
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Colors } from './palette.types'
const colors: Colors = {
helper: {
500: '#8C8CA1'
Function createTypography
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function createTypography(typographyOption: TypographyOptions = {}): Typography {
const options = deepMerge(typographyOption, defaultTypographyOptions)
const {
fontFamily,
Function AwesomeButton
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AwesomeButton: React.ForwardRefRenderFunction<HTMLButtonElement, ButtonProps> = (
props,
ref
) => {
const theme = useTheme()
Function createPalette
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function createPalette(paletteOptions: PaletteOptions = {}): Palette {
const allPaletteOptions = deepMerge(defaultPaletteOptions, paletteOptions)
const {
primary,
secondary,
Function AwesomeButton
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const AwesomeButton: React.ForwardRefRenderFunction<HTMLButtonElement, ButtonProps> = (
props,
ref
) => {
const theme = useTheme()
- 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 (gapX) {
styles = { ...styles, columnGap: getSpacing(gapX) }
}
Avoid deeply nested control flow statements. Open
if (gapY) {
styles = { ...styles, rowGap: getSpacing(gapY) }
}
Function generateButtonConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
(buttonThemeOptions = {}) =>
(componentProps, theme) => {
const defaultButtonThemeOptions = getDefaultButtonThemeOptions(theme.spacing)
const themeOptions = deepMerge(defaultButtonThemeOptions, buttonThemeOptions)
const assignedProps = deepMerge(themeOptions.default, componentProps)
- 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 deepMerge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const deepMerge = <T extends Record<string, any>[]>(
...objects: T
): TUnionToIntersection<T[number]> =>
objects.reduce((result, current) => {
Object.keys(current).forEach(key => {
- 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 createPalette
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function createPalette(paletteOptions: PaletteOptions = {}): Palette {
const allPaletteOptions = deepMerge(defaultPaletteOptions, paletteOptions)
const {
primary,
secondary,
- 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 getSpacing
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getSpacing = (
spacer: string | number,
sizing?: SpacingSizing,
compute?: SpacingFn
): string => {
- 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 getSpacingComponents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getSpacingComponents = (spacing: string): { spacer: number; unit: string } => {
let amount = ''
let unit = ''
for (const char of spacing) {
- 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"