basantech89/awesome-ui

View on GitHub

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') {
Severity: Minor
Found in src/utils/theme.ts - About 5 hrs 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 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
Severity: Major
Found in src/shared/theme/themeEngine/componentConfig/button/index.ts - About 3 hrs to fix

    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'
    Severity: Minor
    Found in src/shared/theme/themeEngine/colors.ts - About 3 hrs to fix

      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,
      Severity: Major
      Found in src/shared/theme/themeEngine/createTypography.ts - About 2 hrs to fix

        Function AwesomeButton has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const AwesomeButton: React.ForwardRefRenderFunction<HTMLButtonElement, ButtonProps> = (
          props,
          ref
        ) => {
          const theme = useTheme()
        Severity: Minor
        Found in src/components/form/button/index.tsx - About 1 hr to fix

          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,
          Severity: Minor
          Found in src/shared/theme/themeEngine/createPalette.ts - About 1 hr to fix

            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()
            Severity: Minor
            Found in src/components/form/button/index.tsx - About 45 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

            Avoid deeply nested control flow statements.
            Open

                    if (gapX) {
                      styles = { ...styles, columnGap: getSpacing(gapX) }
                    }
            Severity: Major
            Found in src/utils/theme.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                      if (gapY) {
                        styles = { ...styles, rowGap: getSpacing(gapY) }
                      }
              Severity: Major
              Found in src/utils/theme.ts - About 45 mins to fix

                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)
                Severity: Minor
                Found in src/shared/theme/themeEngine/componentConfig/button/index.ts - About 45 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 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 => {
                Severity: Minor
                Found in src/utils/object.ts - About 35 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 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,
                Severity: Minor
                Found in src/shared/theme/themeEngine/createPalette.ts - About 35 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 getSpacing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                export const getSpacing = (
                  spacer: string | number,
                  sizing?: SpacingSizing,
                  compute?: SpacingFn
                ): string => {
                Severity: Minor
                Found in src/utils/theme.ts - 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 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) {
                Severity: Minor
                Found in src/utils/theme.ts - 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