Showing 128 of 341 total issues

Function cloneElement has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

export default function cloneElement (vnode, props?: object, ...children): any {
  if (isVText(vnode)) {
    return createVText(vnode.text)
  }
  if (isString(vnode) || isNumber(vnode)) {
Severity: Minor
Found in packages/nerv/src/clone-element.ts - About 3 hrs 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

File event.ts has 326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { isFunction, MapClass, doc, isiOS, isIE9, isTaro } from 'nerv-utils'
import { noop } from 'nerv-shared'
import { supportedPassiveEventMap } from './passive-event'

const ONINPUT = 'oninput'
Severity: Minor
Found in packages/nerv/src/event.ts - About 3 hrs to fix

    Function exports has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (config) {
      config.set({
        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '.',
    
    
    Severity: Major
    Found in karma.conf.js - About 3 hrs to fix

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

        render() {
          return (
            <div className="container">
              <div className="jumbotron">
                <div className="row">
      Severity: Major
      Found in benchmarks/js-framwork-bench/src/Main.jsx - About 3 hrs to fix

        Function updateComponent has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        export function updateComponent (component, isForce = false) {
          let vnode = component.vnode
          let dom = vnode.dom
          const props = component.props
          let state = component.getState()
        Severity: Minor
        Found in packages/nerv/src/lifecycle.ts - About 3 hrs 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 MemoryStats has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var MemoryStats = function() {
          var msMin = 100
          var msMax = 0
        
          var container = document.createElement('div')
        Severity: Major
        Found in benchmarks/DBMonster/memory-stats.js - About 3 hrs to fix

          Function updateComponent has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function updateComponent (component, isForce = false) {
            let vnode = component.vnode
            let dom = vnode.dom
            const props = component.props
            let state = component.getState()
          Severity: Major
          Found in packages/nerv/src/lifecycle.ts - About 2 hrs to fix

            Function patch has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function patch (
              lastVnode,
              nextVnode,
              parentNode: Element,
              context: object,
            Severity: Major
            Found in packages/nerv/src/vdom/patch.ts - About 2 hrs to fix

              Function unmount has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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

              File svg-property-config.ts has 273 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              const NS = {
                ev: 'http://www.w3.org/2001/xml-events',
                xlink: 'http://www.w3.org/1999/xlink',
                xml: 'http://www.w3.org/XML/1998/namespace'
              }
              Severity: Minor
              Found in packages/nerv/src/vdom/svg-property-config.ts - About 2 hrs to fix

                Function Monitoring has 62 lines of code (exceeds 25 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: Major
                Found in benchmarks/DBMonster/monitor.js - About 2 hrs to fix

                  Function MemoryStats has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var MemoryStats = function() {
                    var msMin = 100
                    var msMax = 0
                  
                    var container = document.createElement('div')
                  Severity: Minor
                  Found in benchmarks/DBMonster/memory-stats.js - About 2 hrs 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 findAllInRenderedTree has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 59 lines of code (exceeds 25 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: Major
                  Found in packages/nerv/src/create-context.ts - About 2 hrs to fix

                    Function patchProp has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function patchProp (
                      domNode: Element,
                      prop: string,
                      lastValue,
                      nextValue,
                    Severity: Major
                    Found in packages/nerv/src/vdom/patch.ts - About 2 hrs to fix

                      Function lis has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function lis (a: number[]): number[] {
                        const p = a.slice()
                        const result: number[] = []
                        result.push(0)
                        let u: number
                      Severity: Minor
                      Found in packages/nerv/src/vdom/patch.ts - About 2 hrs 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 addEventListener has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              addEventListener: valueDesc(function (type, handler, capture) {
                                if (typeof handler !== 'function' && typeof handler !== 'object') return;
                                var
                                  self = this,
                                  ontype = 'on' + type,
                      Severity: Major
                      Found in browsers/polyfill.js - About 2 hrs to fix

                        Function patchStyle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function patchStyle (lastAttrValue: CSSStyleSheet, nextAttrValue: CSSStyleSheet, dom: HTMLElement) {
                          const domStyle = dom.style
                          let style
                          let value
                        
                        
                        Severity: Minor
                        Found in packages/nerv/src/vdom/patch.ts - About 2 hrs 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 cloneElement has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function cloneElement (vnode, props?: object, ...children): any {
                          if (isVText(vnode)) {
                            return createVText(vnode.text)
                          }
                          if (isString(vnode) || isNumber(vnode)) {
                        Severity: Major
                        Found in packages/nerv/src/clone-element.ts - About 2 hrs to fix

                          Function getComputedStyle has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  getComputedStyle: valueDesc(function(){
                            
                                    var // partially grabbed from jQuery and Dean's hack
                                      notpixel = /^(?:[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/,
                                      position = /^(top|right|bottom|left)$/,
                          Severity: Major
                          Found in browsers/polyfill.js - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language