Showing 341 of 341 total issues

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

  select(id) {
    startMeasure("select");
    this.state.store.select(id);
    this.setState({ store: this.state.store });
  }
Severity: Major
Found in benchmarks/js-framwork-bench/src/Main.jsx and 1 other location - About 1 hr to fix
benchmarks/js-framwork-bench/src/Main.jsx on lines 128..132

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

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

        nextElementSibling: {
          get: function () {
            var nextElementSibling = this.nextSibling;
            while (nextElementSibling && nextElementSibling.nodeType != 1) {
              nextElementSibling = nextElementSibling.nextSibling;
Severity: Major
Found in browsers/polyfill.js and 1 other location - About 1 hr to fix
browsers/polyfill.js on lines 334..342

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

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

function collateMixins (mixins: Function[] | any[], keyed = {}): any {
  for (let i = 0, len = mixins.length; i < len; i++) {
    const mixin = mixins[i]

    if (mixin.mixins) {
Severity: Minor
Found in packages/nerv-create-class/src/index.ts - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function f has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function f () {
  const response = await prompts({
    type: 'select',
    name: 'version',
    message: `What's the release version?`,
Severity: Minor
Found in release.js - About 1 hr to fix

    Function mountVNode has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function mountVNode (vnode: VNode, isSvg?: boolean, parentContext?, parentComponent?) {
      if (vnode.isSvg) {
        isSvg = true
      } else if (vnode.type === 'svg') {
        isSvg = true
    Severity: Minor
    Found in packages/nerv/src/vdom/create-element.ts - About 1 hr to fix

      Function verifyLifycycleMethods has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const verifyLifycycleMethods = TestComponent => {
            const proto = TestComponent.prototype
            const protoSpy = {}
            spies.forEach(s => {
              protoSpy[s] = sinon.spy(proto, s)
      Severity: Minor
      Found in packages/nerv/__tests__/lifecycle.spec.js - About 1 hr to fix

        Function componentDidMount has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              componentDidMount () {
                this.setState(
                  {
                    a: true
                  },
        Severity: Minor
        Found in packages/nerv/__tests__/component.spec.js - About 1 hr to fix

          Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                render () {
                  inst = this
                  const { step } = this.state
                  if (step === 0) {
                    return null
          Severity: Minor
          Found in packages/nerv/__tests__/svg.spec.js - About 1 hr to fix

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

                  class Comp extends Component {
                    render () {
                      return <div>{this.context.foo + '-' + this.context.getFoo()}</div>
                    }
                  }
            Severity: Major
            Found in packages/nerv/__tests__/dom.spec.js and 1 other location - About 1 hr to fix
            packages/nerv/__tests__/dom.spec.js on lines 164..168

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

            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 unmount has 30 lines of code (exceeds 25 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 1 hr to fix

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

                it('should apply class as String', () => {
                  render(<div class='foo' />, scratch)
                  expect(scratch.childNodes[0].className).toBe('foo')
                })
              Severity: Major
              Found in packages/nerv/__tests__/render.spec.js and 1 other location - About 1 hr to fix
              packages/nerv/__tests__/render.spec.js on lines 218..221

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

              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

                      pageX: {get: function(){ return this._pageX || (this._pageX = this.clientX + window.scrollX - (html.clientLeft || 0)); }},
              Severity: Major
              Found in browsers/polyfill.js and 1 other location - About 1 hr to fix
              browsers/polyfill.js on lines 588..588

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

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

                update (vnode) {
                  const data = getData(vnode)
              
                  // Children must be updated first
                  if (Array.isArray(data.children)) {
              Severity: Minor
              Found in packages/nerv-devtools/src/renderer.ts - About 1 hr to fix

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

                    expect(container.textContent.split(',')).toEqual(
                      arr7.map(({ n }) => String(n)).concat([''])
                    )
                Severity: Major
                Found in packages/nerv/__tests__/keys.spec.js and 4 other locations - About 1 hr to fix
                packages/nerv/__tests__/keys.spec.js on lines 81..83
                packages/nerv/__tests__/keys.spec.js on lines 90..92
                packages/nerv/__tests__/keys.spec.js on lines 95..97
                packages/nerv/__tests__/keys.spec.js on lines 105..107

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

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

                    expect(container.textContent.split(',')).toEqual(
                      arr5.map(({ n }) => String(n)).concat([''])
                    )
                Severity: Major
                Found in packages/nerv/__tests__/keys.spec.js and 4 other locations - About 1 hr to fix
                packages/nerv/__tests__/keys.spec.js on lines 81..83
                packages/nerv/__tests__/keys.spec.js on lines 95..97
                packages/nerv/__tests__/keys.spec.js on lines 100..102
                packages/nerv/__tests__/keys.spec.js on lines 105..107

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

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

                    expect(container.textContent.split(',')).toEqual(
                      arr4.map(({ n }) => String(n)).concat([''])
                    )
                Severity: Major
                Found in packages/nerv/__tests__/keys.spec.js and 4 other locations - About 1 hr to fix
                packages/nerv/__tests__/keys.spec.js on lines 90..92
                packages/nerv/__tests__/keys.spec.js on lines 95..97
                packages/nerv/__tests__/keys.spec.js on lines 100..102
                packages/nerv/__tests__/keys.spec.js on lines 105..107

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

                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 alias className to class', () => {
                    render(<div className='bar' />, scratch)
                    expect(scratch.childNodes[0].className).toBe('bar')
                  })
                Severity: Major
                Found in packages/nerv/__tests__/render.spec.js and 1 other location - About 1 hr to fix
                packages/nerv/__tests__/render.spec.js on lines 213..216

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

                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

                        pageY: {get: function(){ return this._pageY || (this._pageY = this.clientY + window.scrollY - (html.clientTop || 0)); }},
                Severity: Major
                Found in browsers/polyfill.js and 1 other location - About 1 hr to fix
                browsers/polyfill.js on lines 587..587

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

                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 Comp () {
                        const [counter, setCounter] = useState(0)
                
                        useEffect(() => {
                          if (counter === 0) setCounter(1)
                Severity: Major
                Found in packages/nerv/__tests__/hooks.spec.js and 1 other location - About 1 hr to fix
                packages/nerv/__tests__/hooks.spec.js on lines 579..588

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

                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 Comp () {
                        const [counter, setCounter] = useState(0)
                
                        useLayoutEffect(() => {
                          if (counter === 0) setCounter(1)
                Severity: Major
                Found in packages/nerv/__tests__/hooks.spec.js and 1 other location - About 1 hr to fix
                packages/nerv/__tests__/hooks.spec.js on lines 683..692

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

                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