crystal-ball/componentry

View on GitHub

Showing 85 of 85 total issues

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