RubyLouvre/anu

View on GitHub
packages/core/__tests__/ReactElement-test.js

Summary

Maintainability
D
2 days
Test Coverage

File ReactElement-test.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
Severity: Minor
Found in packages/core/__tests__/ReactElement-test.js - About 5 hrs to fix

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

            if (__DEV__) {
                expect(ReactDOM.findDOMNode(outer).className).toBe('moo');
            } else {
                expect(ReactDOM.findDOMNode(outer).className).toBe('quack');
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 1 other location - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 419..423

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

    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

            if (__DEV__) {
                expect(ReactDOM.findDOMNode(outer).className).toBe('');
            } else {
                expect(ReactDOM.findDOMNode(outer).className).toBe('quack');
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 1 other location - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 389..393

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

    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

            if (__DEV__) {
                expect(() => (element.type = 'div')).toThrow();
            } else {
                expect(() => (element.type = 'div')).not.toThrow();
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 1 other location - About 1 hr to fix
    packages/core/__tests__/ReactJSXElement-test.js on lines 55..59

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

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

            if (__DEV__) {
                expect(Object.isFrozen(element)).toBe(true);
                expect(Object.isFrozen(element.props)).toBe(true);
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 7 other locations - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 53..56
    packages/core/__tests__/ReactElement-test.js on lines 125..128
    packages/core/__tests__/ReactElement-test.js on lines 180..183
    packages/core/__tests__/ReactElement-test.js on lines 197..200
    packages/core/__tests__/ReactElement-test.js on lines 219..222
    packages/core/__tests__/ReactElementClone-test.js on lines 325..328
    packages/core/__tests__/ReactElementClone-test.js on lines 347..350

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

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

            if (__DEV__) {
                expect(Object.isFrozen(element)).toBe(true);
                expect(Object.isFrozen(element.props)).toBe(true);
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 7 other locations - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 53..56
    packages/core/__tests__/ReactElement-test.js on lines 164..167
    packages/core/__tests__/ReactElement-test.js on lines 180..183
    packages/core/__tests__/ReactElement-test.js on lines 197..200
    packages/core/__tests__/ReactElement-test.js on lines 219..222
    packages/core/__tests__/ReactElementClone-test.js on lines 325..328
    packages/core/__tests__/ReactElementClone-test.js on lines 347..350

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

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

            if (__DEV__) {
                expect(Object.isFrozen(element)).toBe(true);
                expect(Object.isFrozen(element.props)).toBe(true);
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 7 other locations - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 53..56
    packages/core/__tests__/ReactElement-test.js on lines 125..128
    packages/core/__tests__/ReactElement-test.js on lines 164..167
    packages/core/__tests__/ReactElement-test.js on lines 180..183
    packages/core/__tests__/ReactElement-test.js on lines 219..222
    packages/core/__tests__/ReactElementClone-test.js on lines 325..328
    packages/core/__tests__/ReactElementClone-test.js on lines 347..350

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

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

            if (__DEV__) {
                expect(Object.isFrozen(element)).toBe(true);
                expect(Object.isFrozen(element.props)).toBe(true);
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 7 other locations - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 53..56
    packages/core/__tests__/ReactElement-test.js on lines 125..128
    packages/core/__tests__/ReactElement-test.js on lines 164..167
    packages/core/__tests__/ReactElement-test.js on lines 197..200
    packages/core/__tests__/ReactElement-test.js on lines 219..222
    packages/core/__tests__/ReactElementClone-test.js on lines 325..328
    packages/core/__tests__/ReactElementClone-test.js on lines 347..350

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

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

            if (__DEV__) {
                expect(Object.isFrozen(element)).toBe(true);
                expect(Object.isFrozen(element.props)).toBe(true);
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 7 other locations - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 125..128
    packages/core/__tests__/ReactElement-test.js on lines 164..167
    packages/core/__tests__/ReactElement-test.js on lines 180..183
    packages/core/__tests__/ReactElement-test.js on lines 197..200
    packages/core/__tests__/ReactElement-test.js on lines 219..222
    packages/core/__tests__/ReactElementClone-test.js on lines 325..328
    packages/core/__tests__/ReactElementClone-test.js on lines 347..350

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

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

            if (__DEV__) {
                expect(Object.isFrozen(element)).toBe(true);
                expect(Object.isFrozen(element.props)).toBe(true);
            }
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 7 other locations - About 1 hr to fix
    packages/core/__tests__/ReactElement-test.js on lines 53..56
    packages/core/__tests__/ReactElement-test.js on lines 125..128
    packages/core/__tests__/ReactElement-test.js on lines 164..167
    packages/core/__tests__/ReactElement-test.js on lines 180..183
    packages/core/__tests__/ReactElement-test.js on lines 197..200
    packages/core/__tests__/ReactElementClone-test.js on lines 325..328
    packages/core/__tests__/ReactElementClone-test.js on lines 347..350

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

    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 Parent extends React.Component {
                render() {
                    return (
                        <div>
                            <Child ref="childElement" />
    Severity: Minor
    Found in packages/core/__tests__/ReactElement-test.js and 1 other location - About 35 mins to fix
    packages/render/dom/__tests__/refs-destruction-test.js on lines 139..147

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

    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 Child extends React.Component {
                render() {
                    return <div> {this.props.key} </div>;
                }
            }
    Severity: Minor
    Found in packages/core/__tests__/ReactElement-test.js and 1 other location - About 35 mins to fix
    packages/core/__tests__/ReactElement-test.js on lines 98..102

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

    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 Child extends React.Component {
                render() {
                    return <div> {this.props.ref} </div>;
                }
            }
    Severity: Minor
    Found in packages/core/__tests__/ReactElement-test.js and 1 other location - About 35 mins to fix
    packages/core/__tests__/ReactElement-test.js on lines 62..66

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

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

            expect(() => ReactDOM.render(<Parent />, container)).toWarnDev(
                'Child: `key` is not a prop. Trying to access it will result ' +
                'in `undefined` being returned. If you need to access the same ' +
                'value within the child component, you should pass it as a different ' +
                'prop. (https://fb.me/react-special-props)',
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 6 other locations - About 30 mins to fix
    packages/core/__tests__/ReactElement-test.js on lines 112..117
    packages/core/__tests__/ReactPureComponent-test.js on lines 69..74
    packages/core/__tests__/ReactPureComponent-test.js on lines 103..108
    packages/render/dom/__tests__/ReactComponent-test.js on lines 587..592
    packages/render/dom/__tests__/ReactComponent-test.js on lines 602..607
    packages/render/dom/__tests__/ReactMount-test.js on lines 186..191

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

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

            expect(() => ReactDOM.render(<Parent />, container)).toWarnDev(
                'Child: `ref` is not a prop. Trying to access it will result ' +
                'in `undefined` being returned. If you need to access the same ' +
                'value within the child component, you should pass it as a different ' +
                'prop. (https://fb.me/react-special-props)',
    Severity: Major
    Found in packages/core/__tests__/ReactElement-test.js and 6 other locations - About 30 mins to fix
    packages/core/__tests__/ReactElement-test.js on lines 78..83
    packages/core/__tests__/ReactPureComponent-test.js on lines 69..74
    packages/core/__tests__/ReactPureComponent-test.js on lines 103..108
    packages/render/dom/__tests__/ReactComponent-test.js on lines 587..592
    packages/render/dom/__tests__/ReactComponent-test.js on lines 602..607
    packages/render/dom/__tests__/ReactMount-test.js on lines 186..191

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

    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

    There are no issues that match your filters.

    Category
    Status