Showing 341 of 341 total issues

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

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

            return condition ? (
              <div>
                <Fragment key='c'>
                  <div>foo</div>
                  <div key='b'>
      Severity: Major
      Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 2 hrs to fix
      packages/nerv/__tests__/fragments.spec.js on lines 1195..1216

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

      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

            return condition ? (
              <div>
                <Fragment key='c'>
                  <div>foo</div>
                  <div key='b'>
      Severity: Major
      Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 2 hrs to fix
      packages/nerv/__tests__/fragments.spec.js on lines 575..595

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

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

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

                class SetState extends Component {
                  constructor (props) {
                    super(props)
                    update = () => this.setState({ active: true })
                  }
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 2 other locations - About 2 hrs to fix
            packages/nerv/__tests__/fragments.spec.js on lines 1644..1653
            packages/nerv/__tests__/fragments.spec.js on lines 1708..1717

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

            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 SetState extends Component {
                  constructor (props) {
                    super(props)
                    update = () => this.setState({ active: true })
                  }
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 2 other locations - About 2 hrs to fix
            packages/nerv/__tests__/fragments.spec.js on lines 1644..1653
            packages/nerv/__tests__/fragments.spec.js on lines 1781..1790

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

            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 SetState extends Component {
                  constructor (props) {
                    super(props)
                    update = () => this.setState({ active: true })
                  }
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 2 other locations - About 2 hrs to fix
            packages/nerv/__tests__/fragments.spec.js on lines 1708..1717
            packages/nerv/__tests__/fragments.spec.js on lines 1781..1790

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

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

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

                class Inner extends Component {
                  shouldComponentUpdate () {
                    return true
                  }
                  componentWillReceiveProps () {}
            Severity: Major
            Found in packages/nerv/__tests__/context.spec.js and 1 other location - About 2 hrs to fix
            packages/nerv/__tests__/context.spec.js on lines 43..53

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

            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 Inner extends Component {
                  shouldComponentUpdate () {
                    return true
                  }
                  componentWillReceiveProps () {}
            Severity: Major
            Found in packages/nerv/__tests__/context.spec.js and 1 other location - About 2 hrs to fix
            packages/nerv/__tests__/context.spec.js on lines 101..111

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

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

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

                    render(
                      <div>
                        <Provider value={CONTEXT}>
                          <NoUpdate>
                            <Consumer>{data => <Inner {...data} />}</Consumer>
                Severity: Major
                Found in packages/nerv/__tests__/createContext.spec.js and 1 other location - About 2 hrs to fix
                packages/nerv/__tests__/createContext.spec.js on lines 218..227

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

                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

                Severity
                Category
                Status
                Source
                Language