nexxtway/react-rainbow

View on GitHub
src/components/Table/body/__test__/selectableCell.spec.js

Summary

Maintainability
F
4 days
Test Coverage

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

    it('should call the right event when shiftKey is not pressed, inputType is "checkbox" and isSelected is passed', () => {
        const onDeselectRowMockFn = jest.fn();
        const onSelectRowMockFn = jest.fn();
        const component = mount(
            <SelectableCell
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 5 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 130..146

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

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 call the right event when shiftKey is pressed, inputType is "checkbox" and isSelected is passed', () => {
        const onDeselectRowMockFn = jest.fn();
        const onSelectRowMockFn = jest.fn();
        const component = mount(
            <SelectableCell
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 5 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 97..113

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

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 call the right event when shiftKey is pressed, inputType is "checkbox" and isSelected is not passed', () => {
        const onDeselectRowMockFn = jest.fn();
        const onSelectRowMockFn = jest.fn();
        const component = mount(
            <SelectableCell
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 5 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 81..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 145.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it('should call the right event when shiftKey is not pressed, inputType is "checkbox" and isSelected is not passed', () => {
        const onDeselectRowMockFn = jest.fn();
        const onSelectRowMockFn = jest.fn();
        const component = mount(
            <SelectableCell
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 5 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 114..129

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 145.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it('should not call event.preventDefault when press right key in input type checkbox', () => {
        const component = mount(<SelectableCell inputType="checkbox" />);
        const preventDefaultMockFn = jest.fn();
        component.find('input').simulate('keyDown', {
            keyCode: RIGHT_KEY,
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 3 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 165..173

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

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 not call event.preventDefault when press left key in input type checkbox', () => {
        const component = mount(<SelectableCell inputType="checkbox" />);
        const preventDefaultMockFn = jest.fn();
        component.find('input').simulate('keyDown', {
            keyCode: LEFT_KEY,
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 3 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 174..182

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

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 call event.preventDefault when press right key in input type radio', () => {
        const component = mount(<SelectableCell inputType="radio" />);
        const preventDefaultMockFn = jest.fn();
        component.find('input').simulate('keyDown', {
            keyCode: RIGHT_KEY,
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 3 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 147..155

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

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 call event.preventDefault when press left key in input type radio', () => {
        const component = mount(<SelectableCell inputType="radio" />);
        const preventDefaultMockFn = jest.fn();
        component.find('input').simulate('keyDown', {
            keyCode: LEFT_KEY,
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 1 other location - About 3 hrs to fix
src/components/Table/body/__test__/selectableCell.spec.js on lines 156..164

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

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

    it('should set the type prop in Input component to checkbox by default', () => {
        const component = mount(<SelectableCell />);
        expect(component.find('Input').prop('type')).toBe('checkbox');
    });
Severity: Major
Found in src/components/Table/body/__test__/selectableCell.spec.js and 7 other locations - About 1 hr to fix
src/components/CheckboxToggle/__test__/checkboxToggle.spec.js on lines 6..9
src/components/Lookup/__test__/lookup.spec.js on lines 17..20
src/components/MenuDivider/__test__/menuDivider.spec.js on lines 6..9
src/components/RadioButtonGroup/__test__/radioButton.spec.js on lines 6..9
src/components/Rating/__test__/star.spec.js on lines 6..9
src/components/Table/head/__test__/selectableHeader.spec.js on lines 11..14
src/components/Table/head/__test__/selectableHeader.spec.js on lines 19..22

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

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