Showing 128 of 341 total issues

Avoid deeply nested control flow statements.
Open

          if (
            isValidElement(lastVnode) &&
            lastVnode.children !== EMPTY_CHILDREN
          ) {
            unmountChildren(lastVnode.children)
Severity: Major
Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

    Function attach has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      attach (vnode, ref, domNode: Element) {
        const node = isComposite(vnode) ? vnode.component : domNode
        if (isFunction(ref)) {
          const componentForCatcher = isComposite(vnode) ? vnode.component : vnode
          errorCatcher(() => {
    Severity: Minor
    Found in packages/nerv/src/vdom/ref.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

    Avoid deeply nested control flow statements.
    Open

          if (isSvg && namespace) {
            if (nextValue) {
              domNode.setAttributeNS(namespace, prop, nextValue)
            } else {
              const colonPosition = prop.indexOf(':')
    Severity: Major
    Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

      Function mountComponent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export function mountComponent (
        vnode: FullComponent,
        parentContext: ParentContext,
        parentComponent
      ) {
      Severity: Minor
      Found in packages/nerv/src/lifecycle.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

      Avoid deeply nested control flow statements.
      Open

                for (let i = 0, len = children.length; i < len; i++) {
                  const child = children[i]
                  if (isString(child)) {
                    renderedString += child === '' ? ' ' : encodeEntities(child)
                  } else if (isNumber(child)) {
      Severity: Major
      Found in packages/nerv-server/src/index.ts - About 45 mins to fix

        Function patchProp has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          domNode: Element,
          prop: string,
          lastValue,
          nextValue,
          lastVnode: VNode | null,
        Severity: Minor
        Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                  if (patched < bLeft) {
                    for (j = bStart; j <= bEnd; j++) {
                      bNode = b[j]
                      if (aNode.key === bNode.key) {
                        sources[j - bStart] = i
          Severity: Major
          Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

            Function getData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export function getData (_vnode) {
              const vnode = _vnode instanceof Component ? _vnode.vnode : _vnode
              const component = vnode.component
              let updater: any = null
            
            
            Severity: Minor
            Found in packages/nerv-devtools/src/utils.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

            Avoid deeply nested control flow statements.
            Open

                      if (!props.value) {
                        renderedString += ` value="${encodeEntities(value)}"`
                      }
            Severity: Major
            Found in packages/nerv-server/src/index.ts - About 45 mins to fix

              Function patchProps has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                domNode: Element,
                nextProps: Props,
                previousProps: Props,
                lastVnode: VNode,
                isSvg?: boolean
              Severity: Minor
              Found in packages/nerv/src/vdom/patch.ts - About 35 mins to fix

                Function patchChildren has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  parentDom: Element,
                  lastChildren,
                  nextChildren,
                  context: object,
                  isSvg: boolean
                Severity: Minor
                Found in packages/nerv/src/vdom/patch.ts - About 35 mins to fix

                  Function patchArrayChildren has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    parentDom: Element,
                    lastChildren,
                    nextChildren,
                    context: object,
                    isSvg: boolean
                  Severity: Minor
                  Found in packages/nerv/src/vdom/patch.ts - About 35 mins to fix

                    Function mountChild has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      child: VNode,
                      domNode: Element,
                      parentContext: Object,
                      isSvg?: boolean,
                      parentComponent?
                    Severity: Minor
                    Found in packages/nerv/src/vdom/create-element.ts - About 35 mins to fix

                      Function dispatchEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function dispatchEvent (event, target, items, count, eventData) {
                      Severity: Minor
                      Found in packages/nerv/src/event.ts - About 35 mins to fix

                        Function patch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          lastVnode,
                          nextVnode,
                          parentNode: Element,
                          context: object,
                          isSvg?: boolean
                        Severity: Minor
                        Found in packages/nerv/src/vdom/patch.ts - About 35 mins to fix

                          Function mountElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function mountElement (
                            element: Element | Text | Comment | Array<Element | Text | Comment>,
                            parentNode: Element,
                            refChild?: Node | null
                          ) {
                          Severity: Minor
                          Found in packages/nerv/src/vdom/create-element.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 transformPropsForComponent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function transformPropsForComponent (props: Props, defaultProps?: Props) {
                            const newProps: any = {}
                            for (const propName in props) {
                              const propValue = props[propName]
                              newProps[propName] = propValue
                          Severity: Minor
                          Found in packages/nerv/src/create-element.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 initDevTools has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function initDevTools () {
                            const hook = (window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__
                            if (hook == null) {
                              return
                            }
                          Severity: Minor
                          Found in packages/nerv-devtools/src/index.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 transformPropsForRealTag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function transformPropsForRealTag (type: string, props: Props) {
                            const newProps: Props = {}
                            for (const propName in props) {
                              const propValue = props[propName]
                              if (propName === 'defaultValue') {
                          Severity: Minor
                          Found in packages/nerv/src/create-element.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

                          Avoid too many return statements within this function.
                          Open

                            return true
                          Severity: Major
                          Found in packages/nerv-utils/src/shallow-equal.ts - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language