Showing 341 of 341 total issues

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

/** @jsx createElement */
import { Component, createElement, render, Fragment } from '../src/index'
import { rerender } from '../src/render-queue'
import { span, div, ul, ol, li, section } from './util/dom'
import { normalizeHTML } from './util'
Severity: Major
Found in packages/nerv/__tests__/fragments.spec.js - About 5 days to fix

    File lifecycle.spec.js has 1664 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 sinon from 'sinon'
    import { EMPTY_CHILDREN, normalizeHTML } from './util'
    Severity: Major
    Found in packages/nerv/__tests__/lifecycle.spec.js - About 4 days to fix

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

      /** @jsx createElement */
      import {
        Component,
        createElement,
        render,
      Severity: Major
      Found in packages/nerv/__tests__/component.spec.js - About 2 days to fix

        Function patchKeyedChildren has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
        Open

        function patchKeyedChildren (
          a: VNode[],
          b: VNode[],
          dom: Element,
          context,
        Severity: Minor
        Found in packages/nerv/src/vdom/patch.ts - About 2 days 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 renderVNodeToString has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
        Open

        function renderVNodeToString (vnode, parent, context, isSvg?: boolean) {
          if (isInvalid(vnode)) {
            return ''
          }
          const { type, props, children } = vnode
        Severity: Minor
        Found in packages/nerv-server/src/index.ts - About 2 days 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 componentDidCatch.spec.js has 759 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /** @jsx createElement */
        /* eslint-disable */
        
        import {
          Component,
        Severity: Major
        Found in packages/nerv/__tests__/componentDidCatch.spec.js - About 1 day to fix

          Function ENV has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
          Open

            (function() {
              var first = true
              var counter = 0
              var data
              var _base
          Severity: Minor
          Found in benchmarks/DBMonster/ENV.js - About 1 day 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

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

            it('should correctly append children #2', () => {
              let inst
              class A extends Component {
                constructor (props) {
                  super(props)
          Severity: Major
          Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 1 day to fix
          packages/nerv/__tests__/fragments.spec.js on lines 2198..2230

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

          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('should correctly append children #3', () => {
              let inst
              class A extends Component {
                constructor (props) {
                  super(props)
          Severity: Major
          Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 1 day to fix
          packages/nerv/__tests__/fragments.spec.js on lines 2164..2196

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

          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

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

          /** @jsx createElement */
          import {
            createElement,
            useEffect,
            useState,
          Severity: Major
          Found in packages/nerv/__tests__/hooks.spec.js - About 1 day to fix

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

              it('should remove orphaned keyed nodes', () => {
                let inst
                class App extends Component {
                  constructor () {
                    super(...arguments)
            Severity: Major
            Found in packages/nerv/__tests__/keys.spec.js and 1 other location - About 1 day to fix
            packages/nerv/__tests__/patch.spec.js on lines 96..131

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

            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('should handle order', () => {
                let inst
                class App extends Component {
                  constructor () {
                    super(...arguments)
            Severity: Major
            Found in packages/nerv/__tests__/patch.spec.js and 1 other location - About 1 day to fix
            packages/nerv/__tests__/keys.spec.js on lines 21..56

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

            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('should correctly append children #1', () => {
                let inst
                class A extends Component {
                  constructor (props) {
                    super(props)
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 1 day to fix
            packages/nerv/__tests__/fragments.spec.js on lines 2098..2129

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

            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('should correctly append children #0', () => {
                let inst
                class A extends Component {
                  constructor (props) {
                    super(props)
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 1 day to fix
            packages/nerv/__tests__/fragments.spec.js on lines 2131..2162

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

            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('should correctly append children #4', () => {
                let inst
                class A extends Component {
                  constructor (props) {
                    super(props)
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 1 day to fix
            packages/nerv/__tests__/fragments.spec.js on lines 2265..2296

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

            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('should correctly append children #5', () => {
                let inst
                class A extends Component {
                  constructor (props) {
                    super(props)
            Severity: Major
            Found in packages/nerv/__tests__/fragments.spec.js and 1 other location - About 1 day to fix
            packages/nerv/__tests__/fragments.spec.js on lines 2232..2263

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

            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

            File patch.ts has 612 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* tslint:disable: no-empty*/
            import {
              isString,
              isAttrAnEvent,
              isNumber,
            Severity: Major
            Found in packages/nerv/src/vdom/patch.ts - About 1 day to fix

              File polyfill.js has 608 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* eslint-disable */
              /*!
              Copyright (C) 2013-2015 by WebReflection
              
              Permission is hereby granted, free of charge, to any person obtaining a copy
              Severity: Major
              Found in browsers/polyfill.js - About 1 day to fix

                Function patchProp has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                Open

                export function patchProp (
                  domNode: Element,
                  prop: string,
                  lastValue,
                  nextValue,
                Severity: Minor
                Found in packages/nerv/src/vdom/patch.ts - About 1 day 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 ENV has 205 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  (function() {
                    var first = true
                    var counter = 0
                    var data
                    var _base
                Severity: Major
                Found in benchmarks/DBMonster/ENV.js - About 1 day to fix
                  Severity
                  Category
                  Status
                  Source
                  Language