Showing 128 of 341 total issues

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 ((attr = self.getAttribute(ontype))) {
                          removeAttribute.call(self, ontype);
                        }
    Severity: Major
    Found in browsers/polyfill.js - 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 (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

        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 (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

            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

            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

            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 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 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 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 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 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

                        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 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 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

                        Avoid too many return statements within this function.
                        Open

                          return newVNode
                        Severity: Major
                        Found in packages/nerv/src/clone-element.ts - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language