crystal-ball/componentry

View on GitHub

Showing 15 of 85 total issues

Function createActiveContainer has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

export function createActiveContainer<
  Name extends ComponentName,
  Props extends ActiveContainerBaseProps,
>(displayName: Name, defaultProps: ActiveContainerDefaults = {}): React.FC<Props> {
  function ActiveContainer(props: Props) {
Severity: Minor
Found in src/utils/create-active-container-component.tsx - About 1 day 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 componentryPlugin has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

export default function componentryPlugin(): ComponentryPlugin {
  // Set up user defined default props and theme values for pre-compilation
  __initializePreCompileMode(config)

  const pluginObj: ComponentryPlugin = {
Severity: Minor
Found in src/plugin-babel/plugin.ts - About 3 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 prepareAttributes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export function prepareAttributes(
  preCompiledAttributes: React.ReactElement<PreCompiledProps>['props'],
  passThroughAttributes: t.JSXAttribute[],
): t.JSXAttribute[] {
  const {
Severity: Minor
Found in src/plugin-babel/prepare-attributes.ts - About 2 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 createActiveContainer has 113 lines of code (exceeds 75 allowed). Consider refactoring.
Open

export function createActiveContainer<
  Name extends ComponentName,
  Props extends ActiveContainerBaseProps,
>(displayName: Name, defaultProps: ActiveContainerDefaults = {}): React.FC<Props> {
  function ActiveContainer(props: Props) {
Severity: Major
Found in src/utils/create-active-container-component.tsx - About 2 hrs to fix

    Function ActiveContainer has 109 lines of code (exceeds 75 allowed). Consider refactoring.
    Open

      function ActiveContainer(props: Props) {
        const {
          // --- Render elements
          children,
    
    
    Severity: Major
    Found in src/utils/create-active-container-component.tsx - About 2 hrs to fix

      Function computeARIA has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      export function computeARIA({
        active,
        activeId,
        guid,
        type,
      Severity: Minor
      Found in src/utils/aria.ts - About 2 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 elementTests has 97 lines of code (exceeds 75 allowed). Consider refactoring.
      Open

      export function elementTests(TestComponent, testProps) {
        const componentName = TestComponent.displayName
      
        /*
         * All components should have a display name so they can be easily debugged
      Severity: Major
      Found in src/test/element-tests.js - About 1 hr to fix

        Function createActiveAction has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export function createActiveAction<
          Name extends ComponentName,
          Props extends ActiveActionBaseProps,
        >(
          displayName: Name,
        Severity: Minor
        Found in src/utils/create-active-action-component.tsx - About 1 hr 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 componentryPlugin has 83 lines of code (exceeds 75 allowed). Consider refactoring.
        Open

        export default function componentryPlugin(): ComponentryPlugin {
          // Set up user defined default props and theme values for pre-compilation
          __initializePreCompileMode(config)
        
          const pluginObj: ComponentryPlugin = {
        Severity: Major
        Found in src/plugin-babel/plugin.ts - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                return
          Severity: Major
          Found in src/plugin-babel/parse-attributes.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return
            Severity: Major
            Found in src/plugin-babel/parse-attributes.ts - About 30 mins to fix

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

              export const plugin: PluginCreator<Record<string, never>> = () => {
                return {
                  postcssPlugin: 'componentry',
                  AtRule: {
                    // Transforms at-rules like `@componentry button;` into component styles
              Severity: Minor
              Found in src/plugin-postcss/plugin.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 Button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const Button = forwardRef<HTMLElement, ButtonProps>((props, ref) => {
                const {
                  variant = 'filled',
                  children,
                  disabled,
              Severity: Minor
              Found in src/components/Button/Button.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 closest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export function closest(target: EventTarget | null, guid: string): EventTarget | null {
                if (!target || !(target instanceof HTMLElement)) return null
              
                if (target.dataset.id === guid) return target
                if (target.parentNode && target.parentNode instanceof HTMLElement) {
              Severity: Minor
              Found in src/utils/dom.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 Alert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const Alert: Alert = (props) => {
                const {
                  children,
                  active: _active,
                  ariaTitle,
              Severity: Minor
              Found in src/components/Alert/Alert.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