Showing 128 of 341 total issues

Function update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  update (vnode) {
    const data = getData(vnode)

    // Children must be updated first
    if (Array.isArray(data.children)) {
Severity: Minor
Found in packages/nerv-devtools/src/renderer.ts - About 55 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 dispatchEvent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function dispatchEvent (event, target, items, count, eventData) {
  const eventsToTrigger = items.get(target)
  if (eventsToTrigger) {
    count--
    eventData.currentTarget = target
Severity: Minor
Found in packages/nerv/src/event.ts - About 55 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 patchKeyedChildren has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  a: VNode[],
  b: VNode[],
  dom: Element,
  context,
  isSvg: boolean,
Severity: Major
Found in packages/nerv/src/vdom/patch.ts - About 50 mins to fix

    Function patchNonKeyedChildren has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function createVNode has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        type: string,
        props: Props,
        children: VirtualChildren,
        key,
        namespace: string,
      Severity: Major
      Found in packages/nerv/src/vdom/create-vnode.ts - About 50 mins to fix

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

          constructor (type, props) {
            this.type = type
            this.name = type.name
            if (isUndefined(this.name)) {
              const names = type.toString().match(/^function\s*([^\s(]+)/)
        Severity: Minor
        Found in packages/nerv/src/full-component.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 detach has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          detach (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 (lastDom != null) {
                parentNode.replaceChild(newDom, lastDom)
              } else {
                parentNode.appendChild(newDom)
              }
        Severity: Major
        Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                } else if (patched !== bLeft) {
                  for (i = bLeft - 1; i >= 0; i--) {
                    if (sources[i] === -1) {
                      pos = i + bStart
                      node = b[pos]
          Severity: Major
          Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    if (aNode !== null) {
                      unmount(aNode, dom)
                      i--
                    }
            Severity: Major
            Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if ((attr = self.getAttribute(ontype))) {
                                    removeAttribute.call(self, ontype);
                                  }
              Severity: Major
              Found in browsers/polyfill.js - About 45 mins to fix

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

                function h (type: string, props: Props, children?: VirtualChildren) {
                  let childNodes
                  if (props.children) {
                    if (!children) {
                      children = props.children
                Severity: Minor
                Found in packages/nerv/src/vdom/h.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 (patched < bLeft) {
                          j = keyIndex.get(aNode.key)
                
                          if (j !== undefined) {
                            bNode = b[j]
                Severity: Major
                Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                          } else if (prop === 'defaultChecked') {
                            if (!props.checked) {
                              renderedString += ` checked="${value}"`
                            }
                          } else if (isSvg && prop.match(/^xlink\:?(.+)/)) {
                  Severity: Major
                  Found in packages/nerv-server/src/index.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if (self.parentNode == null) {
                                          div.appendChild(self);
                                        }
                    Severity: Major
                    Found in browsers/polyfill.js - About 45 mins to fix

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

                      function addChildren (
                        childNodes: VirtualNode[],
                        children: VirtualNode | VirtualNode[],
                        type: string
                      ) {
                      Severity: Minor
                      Found in packages/nerv/src/vdom/h.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 createContext has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function createContext<T> (defaultValue: T): Context<T> {
                        const contextProp = '__context_' + uid++ + '__'
                      
                        class Provider extends Component<ProviderProps<T>> {
                          static isContextProvider = true
                      Severity: Minor
                      Found in packages/nerv/src/create-context.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 fixEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function fixEvent (node: Element, eventName: string) {
                        if (isTaro && eventName === 'onClick') {
                          eventName = 'onTap'
                        }
                        if (eventName === 'onDoubleClick') {
                      Severity: Minor
                      Found in packages/nerv/src/event.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 (i = bLeft - 1; i >= 0; i--) {
                                if (sources[i] === -1) {
                                  pos = i + bStart
                                  node = b[pos]
                                  nextPos = pos + 1
                      Severity: Major
                      Found in packages/nerv/src/vdom/patch.ts - About 45 mins to fix

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

                        export function getChildren (vnode) {
                          const c = vnode.component
                        
                          if (c == null) {
                            if (vnode.children) {
                        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

                        Severity
                        Category
                        Status
                        Source
                        Language