Showing 128 of 341 total issues

Function getData has 50 lines of code (exceeds 25 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 2 hrs to fix

    Function attachEvent has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function attachEvent (
      domNode: Element,
      eventName: string,
      handler: Function
    ) {
    Severity: Minor
    Found in packages/nerv/src/event.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 getData has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function getData(keepIdentity) {
          var oldData = data
          if (!keepIdentity) {
            // reset for each tick when !keepIdentity
            data = []
    Severity: Minor
    Found in benchmarks/DBMonster/ENV.js - About 1 hr to fix

      Function generateRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function generateRow(object, keepIdentity, counter) {
            var nbQueries = Math.floor(Math.random() * 10 + 1)
            if (!object) {
              object = {}
            }
      Severity: Minor
      Found in benchmarks/DBMonster/ENV.js - About 1 hr to fix

        Function RenderRate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var RenderRate = function() {
              var container = document.createElement('div')
              container.id = 'stats'
              container.style.cssText =
                'width:150px;opacity:0.9;cursor:pointer;position:fixed;right:80px;bottom:0px;'
        Severity: Minor
        Found in benchmarks/DBMonster/monitor.js - About 1 hr to fix

          Function createElement has a Cognitive Complexity of 14 (exceeds 5 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

          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 patchNonKeyedChildren has a Cognitive Complexity of 14 (exceeds 5 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

          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 mountComponent has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function mountComponent (
            vnode: FullComponent,
            parentContext: ParentContext,
            parentComponent
          ) {
          Severity: Minor
          Found in packages/nerv/src/lifecycle.ts - About 1 hr to fix

            Function detachEvent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            export function detachEvent (
              domNode: Element,
              eventName: string,
              handler: Function
            ) {
            Severity: Minor
            Found in packages/nerv/src/event.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 lis has 39 lines of code (exceeds 25 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 1 hr to fix

              Function mount has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                mount (vnode) {
                  this.instMap.set(getInstance(vnode), vnode)
                  const data = getData(vnode)
              
                  const work = [
              Severity: Minor
              Found in packages/nerv-devtools/src/renderer.ts - About 1 hr to fix

                Function attachEvent has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function attachEvent (
                  domNode: Element,
                  eventName: string,
                  handler: Function
                ) {
                Severity: Minor
                Found in packages/nerv/src/event.ts - About 1 hr to fix

                  Function createElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function createElement<T> (
                    type: string | Function | Component<any, any>,
                    properties?: T & Props | null,
                    ..._children: Array<VirtualChildren | null>
                  ) {
                  Severity: Minor
                  Found in packages/nerv/src/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 extend has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const extend = ((): (<S, F>(source: S, from: F) => S | F & S) => {
                    if ('assign' in Object) {
                      return <S, F>(source: S, from: F): S | F & S => {
                        if (!from) {
                          return source
                  Severity: Minor
                  Found in packages/nerv-utils/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 renderStylesToString has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function renderStylesToString (styles: string | object): string {
                    if (isString(styles)) {
                      return styles
                    } else {
                      let renderedString = ''
                  Severity: Minor
                  Found in packages/nerv-server/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 mergeNoDupes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function mergeNoDupes (previous: any, current: any) {
                    if (!isUndefined(current)) {
                      if (!previous) {
                        previous = {}
                      }
                  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 patchArrayChildren has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function createClass has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function createClass<P, S> (
                      obj: ComponentSpec<P, S>
                    ): ClassicComponentClass<P, S> {
                      class BoundClass extends Component<P, S> {
                        static defaultProps
                    Severity: Minor
                    Found in packages/nerv-create-class/src/index.ts - About 1 hr to fix

                      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 patchArrayChildren has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function patchArrayChildren (
                        parentDom: Element,
                        lastChildren,
                        nextChildren,
                        context: object,
                      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

                      Severity
                      Category
                      Status
                      Source
                      Language