Showing 341 of 341 total issues

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    render(
      <div>
        <div>A</div>
        <SetState />
        <div>C</div>
Severity: Major
Found in packages/nerv/__tests__/fragments.spec.js and 3 other locations - About 55 mins to fix
packages/nerv/__tests__/fragments.spec.js on lines 1577..1584
packages/nerv/__tests__/fragments.spec.js on lines 1655..1662
packages/nerv/__tests__/fragments.spec.js on lines 1687..1694

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    render(
      <div>
        <div>A</div>
        <SetState />
        <div>C</div>
Severity: Major
Found in packages/nerv/__tests__/fragments.spec.js and 3 other locations - About 55 mins to fix
packages/nerv/__tests__/fragments.spec.js on lines 1577..1584
packages/nerv/__tests__/fragments.spec.js on lines 1621..1628
packages/nerv/__tests__/fragments.spec.js on lines 1655..1662

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if (this.state.error) {
                  return <span>{`Caught an error: ${this.state.error.message}.`}</span>
                }
        Severity: Minor
        Found in packages/nerv/__tests__/componentDidCatch.spec.js and 1 other location - About 50 mins to fix
        packages/nerv/__tests__/componentDidCatch.spec.js on lines 820..822

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 52.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if (this.state.error) {
                  return <span>{`Caught an error: ${this.state.error.message}.`}</span>
                }
        Severity: Minor
        Found in packages/nerv/__tests__/componentDidCatch.spec.js and 1 other location - About 50 mins to fix
        packages/nerv/__tests__/componentDidCatch.spec.js on lines 786..788

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 52.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                render () {
                  return <div onClick={this.click.bind(this)}>{this.state.count}</div>
                }
        Severity: Major
        Found in packages/nerv/__tests__/component.spec.js and 2 other locations - About 50 mins to fix
        packages/nerv/__tests__/component.spec.js on lines 638..640
        packages/nerv/__tests__/component.spec.js on lines 846..848

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                render () {
                  return <div onClick={this.click.bind(this)}>{this.state.count}</div>
                }
        Severity: Major
        Found in packages/nerv/__tests__/component.spec.js and 2 other locations - About 50 mins to fix
        packages/nerv/__tests__/component.spec.js on lines 607..609
        packages/nerv/__tests__/component.spec.js on lines 846..848

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                render () {
                  return <div onClick={this.click.bind(this)}>{this.state.a}</div>
                }
        Severity: Major
        Found in packages/nerv/__tests__/component.spec.js and 2 other locations - About 50 mins to fix
        packages/nerv/__tests__/component.spec.js on lines 607..609
        packages/nerv/__tests__/component.spec.js on lines 638..640

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                      <Fragment>
                        <Fragment>
                          Hello World
                          <h2>yo</h2>
                        </Fragment>
        Severity: Minor
        Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 50 mins to fix
        packages/nerv/__tests__/fragments.spec.js on lines 880..887

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          beforeEach(() => {
            container = document.createElement('div')
            const c = container.firstElementChild
            if (c) {
              render(<Empty />, container)
        Severity: Minor
        Found in packages/nerv-redux/__tests__/provider.spec.js and 1 other location - About 50 mins to fix
        packages/nerv/__tests__/componentDidCatch.spec.js on lines 12..18

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        function clearRender(dom) {
          scratch = document.createElement('div')
          const c = dom.firstElementChild
          if (c) {
            render(<Empty />, dom)
        Severity: Minor
        Found in packages/nerv/__tests__/componentDidCatch.spec.js and 1 other location - About 50 mins to fix
        packages/nerv-redux/__tests__/provider.spec.js on lines 17..23

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                      <Fragment>
                        foobar
                        <Fragment>
                          Hello World
                          <h2>yo</h2>
        Severity: Minor
        Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 50 mins to fix
        packages/nerv/__tests__/fragments.spec.js on lines 889..896

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Avoid deeply nested control flow statements.
        Open

                  if (
                    isValidElement(lastVnode) &&
                    lastVnode.children !== EMPTY_CHILDREN
                  ) {
                    unmountChildren(lastVnode.children)
        Severity: Major
        Found in packages/nerv/src/vdom/patch.ts - About 45 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

          Avoid deeply nested control flow statements.
          Open

                    for (let i = 0, len = children.length; i < len; i++) {
                      const child = children[i]
                      if (isString(child)) {
                        renderedString += child === '' ? ' ' : encodeEntities(child)
                      } else if (isNumber(child)) {
          Severity: Major
          Found in packages/nerv-server/src/index.ts - About 45 mins to fix

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

                        } 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
                  Severity
                  Category
                  Status
                  Source
                  Language