xylabs/sdk-react

View on GitHub

Showing 48 of 179 total issues

Function BusyBox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  (
    {
      background,
      children,
      busyVariant = 'circular',
Severity: Minor
Found in packages/flexbox/src/components/BusyBox/BusyBox.tsx - About 25 mins to fix

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 useMenuItemsShared has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const useMenuItemsShared = () => {
  const {
    collapse, collapseEnd, setCollapse, setCollapseEnd,
  } = useCollapsible()

Severity: Minor
Found in packages/appbar/src/SiteMenu/hooks/useMenuItemsShared.tsx - About 25 mins to fix

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 CoverProgress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const CoverProgress: React.FC<CoverProgressProps> = (props) => {
  const {
    paper = true, open, opacity = 0.25, errors, onRetry,
  } = props
  const theme = useTheme()
Severity: Minor
Found in packages/common/src/components/CoverProgress.tsx - About 25 mins to fix

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 AppBarExInner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AppBarExInner: React.FC<AppBarExProps> = ({
  children, menu, contextToolbar, systemToolbar, responsive, ...props
}) => {
  const { breakpoints } = useTheme()
  const belowSm = useMediaQuery(breakpoints.down('sm'))
Severity: Minor
Found in packages/appbar/src/AppBarEx.tsx - About 25 mins to fix

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 InvertibleCssVarsProvider has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const InvertibleCssVarsProvider: React.FC<InvertibleMuiThemeProviderProps> = ({
  children,
  defaultMode = 'system',
  noResponsiveFontSizes,
  theme,

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 SimpleAccordion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const SimpleAccordion: React.FC<SimpleAccordionCardProps> = ({
  name, linkText, to, href, description, expanded, onChange, children,
}) => {
  const theme = useTheme()
  const isMobile = useMediaQuery(theme.breakpoints.down('md'))
Severity: Minor
Found in packages/accordion/src/AccordionGroup.tsx - About 25 mins to fix

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 asButtonHrefOrToProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const asButtonHrefOrToProps = (props: ButtonHrefAndToProps): ButtonHrefOrToOrNoProps => {
  if (props.href && (props.to || props.toOptions)) {
    throw new Error('ButtonExProps: cannot have both href and to')
  }
  return props.href ? { href: props.href } : props.to ? { to: props.to, toOptions: props.toOptions } : {}
Severity: Minor
Found in packages/button/src/components/ButtonExProps.tsx - About 25 mins to fix

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 asLinkHrefOrToProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const asLinkHrefOrToProps = (props: LinkHrefAndToProps): LinkHrefOrToOrNoProps => {
  if (props.href && (props.to || props.toOptions)) {
    throw new Error('LinkExProps: cannot have both href and to')
  }
  return props.href ? { href: props.href } : props.to ? { to: props.to, toOptions: props.toOptions } : {}
Severity: Minor
Found in packages/link/src/LinkExProps.tsx - About 25 mins to fix

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

Severity
Category
Status
Source
Language