Showing 341 of 341 total issues

File createContext.spec.js has 478 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** @jsx createElement */
import { Component, createElement, render, createContext } from '../src/index'
import { rerender } from '../src/render-queue'
import { uid } from '../src/create-context'
import sinon from 'sinon'
Severity: Minor
Found in packages/nerv/__tests__/createContext.spec.js - About 7 hrs to fix

    File refs.spec.js has 469 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /** @jsx createElement */
    import { Component, createElement, render, findDOMNode, createRef, forwardRef, memo } from '../src'
    import sinon from 'sinon'
    
    const spy = (name, ...args) => {
    Severity: Minor
    Found in packages/nerv/__tests__/refs.spec.js - About 7 hrs to fix

      File render.spec.js has 448 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /** @jsx createElement */
      import { Component, createElement, render, findDOMNode } from '../src'
      import { rerender } from '../src/render-queue'
      import { getAttributes, normalizeHTML, delay } from './util'
      
      
      Severity: Minor
      Found in packages/nerv/__tests__/render.spec.js - About 6 hrs to fix

        Function patchKeyedChildren has 167 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function patchKeyedChildren (
          a: VNode[],
          b: VNode[],
          dom: Element,
          context,
        Severity: Major
        Found in packages/nerv/src/vdom/patch.ts - About 6 hrs to fix

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

                class Foo extends Component {
                  constructor (props, context) {
                    super(props, context)
                    this.state = {
                      value: 'initial'
          Severity: Major
          Found in packages/nerv/__tests__/lifecycle.spec.js and 1 other location - About 5 hrs to fix
          packages/nerv/__tests__/lifecycle.spec.js on lines 902..926

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

          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

                class Foo extends Component {
                  constructor (props, context) {
                    super(props, context)
                    this.state = {
                      value: 'initial'
          Severity: Major
          Found in packages/nerv/__tests__/lifecycle.spec.js and 1 other location - About 5 hrs to fix
          packages/nerv/__tests__/lifecycle.spec.js on lines 863..886

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

          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

              class A extends Component {
                constructor (props) {
                  super(props)
                  this.state = { active: true }
                  updateA = () => this.setState(prev => ({ active: !prev.active }))
          Severity: Major
          Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 5 hrs to fix
          packages/nerv/__tests__/fragments.spec.js on lines 2044..2056

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

          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

              class A extends Component {
                constructor (props) {
                  super(props)
                  this.state = { active: true }
                  updateA = () => this.setState(prev => ({ active: !prev.active }))
          Severity: Major
          Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 5 hrs to fix
          packages/nerv/__tests__/fragments.spec.js on lines 1915..1927

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

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

          export function patch (
            lastVnode,
            nextVnode,
            parentNode: Element,
            context: object,
          Severity: Minor
          Found in packages/nerv/src/vdom/patch.ts - About 5 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

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

                class Receiver extends Component {
                  constructor () {
                    super()
                    this.state = { foo: 'bar' }
                    receiver = this
          Severity: Major
          Found in packages/nerv/__tests__/lifecycle.spec.js and 1 other location - About 5 hrs to fix
          packages/nerv/__tests__/lifecycle.spec.js on lines 1659..1671

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

          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

                class Receiver extends Component {
                  constructor () {
                    super()
                    this.state = { foo: 'bar' }
                    receiver = this
          Severity: Major
          Found in packages/nerv/__tests__/lifecycle.spec.js and 1 other location - About 5 hrs to fix
          packages/nerv/__tests__/lifecycle.spec.js on lines 1689..1701

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

          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 3 locations. Consider refactoring.
          Open

                class Outer extends Component {
                  constructor (p, c) {
                    super(p, c)
                    this.state = { i: 0 }
                  }
          Severity: Major
          Found in packages/nerv/__tests__/lifecycle.spec.js and 2 other locations - About 4 hrs to fix
          packages/nerv/__tests__/lifecycle.spec.js on lines 32..43
          packages/nerv/__tests__/lifecycle.spec.js on lines 170..181

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

          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 3 locations. Consider refactoring.
          Open

                class Outer extends Component {
                  constructor (p, c) {
                    super(p, c)
                    this.state = { i: 0 }
                  }
          Severity: Major
          Found in packages/nerv/__tests__/lifecycle.spec.js and 2 other locations - About 4 hrs to fix
          packages/nerv/__tests__/lifecycle.spec.js on lines 32..43
          packages/nerv/__tests__/lifecycle.spec.js on lines 133..144

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

          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 3 locations. Consider refactoring.
          Open

                class Outer extends Component {
                  constructor (p, c) {
                    super(p, c)
                    this.state = { i: 0 }
                  }
          Severity: Major
          Found in packages/nerv/__tests__/lifecycle.spec.js and 2 other locations - About 4 hrs to fix
          packages/nerv/__tests__/lifecycle.spec.js on lines 133..144
          packages/nerv/__tests__/lifecycle.spec.js on lines 170..181

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

          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

            it('renders an error state if child throws in componentWillMount', async () => {
              var container = document.createElement('div')
              render(
                <ErrorBoundary>
                  <BrokenComponentWillMount />
          Severity: Major
          Found in packages/nerv/__tests__/componentDidCatch.spec.js and 1 other location - About 4 hrs to fix
          packages/nerv/__tests__/componentDidCatch.spec.js on lines 605..619

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

          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

            it('renders an error state if child throws in render', async () => {
              var container = document.createElement('div')
              render(
                <ErrorBoundary>
                  <BrokenRender />
          Severity: Major
          Found in packages/nerv/__tests__/componentDidCatch.spec.js and 1 other location - About 4 hrs to fix
          packages/nerv/__tests__/componentDidCatch.spec.js on lines 621..634

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

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

          function renderVNodeToString (vnode, parent, context, isSvg?: boolean) {
            if (isInvalid(vnode)) {
              return ''
            }
            const { type, props, children } = vnode
          Severity: Major
          Found in packages/nerv-server/src/index.ts - About 4 hrs to fix

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

                class A extends Component {
                  constructor (props) {
                    super(props)
                    this.state = { active: true }
                    updateA = () => this.setState(prev => ({ active: !prev.active }))
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 4 hrs to fix
            packages/nerv/__tests__/fragments.spec.js on lines 1975..1985

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

            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

                class A extends Component {
                  constructor (props) {
                    super(props)
                    this.state = { active: true }
                    updateA = () => this.setState(prev => ({ active: !prev.active }))
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 4 hrs to fix
            packages/nerv/__tests__/fragments.spec.js on lines 1862..1872

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

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

            export function initDevTools () {
              const hook = (window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__
              if (hook == null) {
                return
              }
            Severity: Major
            Found in packages/nerv-devtools/src/index.ts - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language