Showing 128 of 341 total issues

Function errorHandler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function errorHandler (component: Component<any, any>, error) {
  // if(!component) { throw error ; return }
  let boundary
  while (true) {
    const { getDerivedStateFromError } = (component as any).constructor
Severity: Minor
Found in packages/nerv/src/lifecycle.ts - 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 mountVNode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function mountVNode (vnode: VNode, isSvg?: boolean, parentContext?, parentComponent?) {
  if (vnode.isSvg) {
    isSvg = true
  } else if (vnode.type === 'svg') {
    isSvg = true
Severity: Minor
Found in packages/nerv/src/vdom/create-element.ts - 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 f has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function f () {
  const response = await prompts({
    type: 'select',
    name: 'version',
    message: `What's the release version?`,
Severity: Minor
Found in release.js - About 1 hr to fix

    Function verifyLifycycleMethods has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const verifyLifycycleMethods = TestComponent => {
          const proto = TestComponent.prototype
          const protoSpy = {}
          spies.forEach(s => {
            protoSpy[s] = sinon.spy(proto, s)
    Severity: Minor
    Found in packages/nerv/__tests__/lifecycle.spec.js - About 1 hr to fix

      Function componentDidMount has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            componentDidMount () {
              this.setState(
                {
                  a: true
                },
      Severity: Minor
      Found in packages/nerv/__tests__/component.spec.js - About 1 hr to fix

        Function mountVNode has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function mountVNode (vnode: VNode, isSvg?: boolean, parentContext?, parentComponent?) {
          if (vnode.isSvg) {
            isSvg = true
          } else if (vnode.type === 'svg') {
            isSvg = true
        Severity: Minor
        Found in packages/nerv/src/vdom/create-element.ts - About 1 hr to fix

          Function unmount has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function unmount (vnode, parentDom?) {
            if (isInvalid(vnode)) {
              return
            }
            const vtype = vnode.vtype
          Severity: Minor
          Found in packages/nerv/src/vdom/unmount.ts - About 1 hr to fix

            Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  render () {
                    inst = this
                    const { step } = this.state
                    if (step === 0) {
                      return null
            Severity: Minor
            Found in packages/nerv/__tests__/svg.spec.js - About 1 hr to fix

              Function update has 30 lines of code (exceeds 25 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 1 hr to fix

                Function getPropertyValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          ComputedStyle.prototype.getPropertyValue = function (name) {
                            var
                              el = this._,
                              style = el.style,
                              currentStyle = el.currentStyle,
                Severity: Minor
                Found in browsers/polyfill.js - About 1 hr to fix

                  Function createElement has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function createElement (
                    vnode: VirtualNode | VirtualNode[],
                    isSvg?: boolean,
                    parentContext?,
                    parentComponent?
                  Severity: Minor
                  Found in packages/nerv/src/vdom/create-element.ts - About 1 hr to fix

                    Function patchNonKeyedChildren has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function patchNonKeyedChildren (
                      parentDom: Element,
                      lastChildren,
                      nextChildren,
                      context: object,
                    Severity: Minor
                    Found in packages/nerv/src/vdom/patch.ts - About 1 hr to fix

                      Function patchProps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function patchProps (
                        domNode: Element,
                        nextProps: Props,
                        previousProps: Props,
                        lastVnode: VNode,
                      Severity: Minor
                      Found in packages/nerv/src/vdom/patch.ts - 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 applyMixins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function applyMixins (Cl: any, mixins: Function[] | any[]) {
                        for (const key in mixins) {
                          if (mixins.hasOwnProperty(key)) {
                            const mixin = mixins[key]
                      
                      
                      Severity: Minor
                      Found in packages/nerv-create-class/src/index.ts - 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 attachEventToDocument has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function attachEventToDocument (d, eventName, delegatedRoots) {
                        const eventHandler = (event) => {
                          const items = delegatedRoots.items
                          const count = items.size
                          if (count > 0) {
                      Severity: Minor
                      Found in packages/nerv/src/event.ts - About 1 hr to fix

                        Function findAllInRenderedTree has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function findAllInRenderedTree (
                          tree: VirtualNode,
                          test: (vnode: VirtualNode) => boolean
                        ) {
                          if (isValidElement(tree) || isComponent(tree) || isDOMComponent) {
                        Severity: Minor
                        Found in packages/nerv-test-utils/src/index.ts - About 1 hr to fix

                          Function commonEventLoop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function commonEventLoop(currentTarget, e, $handlers, synthetic) {
                                for(var
                                  handler,
                                  continuePropagation,
                                  handlers = $handlers.slice(),
                          Severity: Minor
                          Found in browsers/polyfill.js - About 1 hr to fix

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

                              (function() {
                                var stats = new MemoryStats()
                                stats.domElement.style.position = 'fixed'
                                stats.domElement.style.right = '0px'
                                stats.domElement.style.bottom = '0px'
                            Severity: Minor
                            Found in benchmarks/DBMonster/monitor.js - 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 shallowEqual has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function shallowEqual (a, b, isProps?) {
                              if (a == null || b == null) {
                                return false
                              }
                            
                            
                            Severity: Minor
                            Found in packages/nerv-devtools/src/utils.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 shallowEqual has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function shallowEqual (obj1, obj2) {
                              if (obj1 === null || obj2 === null) {
                                return false
                              }
                              if (Object.is(obj1, obj2)) {
                            Severity: Minor
                            Found in packages/nerv-utils/src/shallow-equal.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

                            Severity
                            Category
                            Status
                            Source
                            Language