nexxtway/react-rainbow

View on GitHub
src/components/MultiSelect/__test__/multiSelect.spec.js

Summary

Maintainability
D
3 days
Test Coverage

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

    it('should not render the buttons when readOnly', () => {
        const value = [
            {
                label: 'First',
                name: 'first',
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 1 other location - About 5 hrs to fix
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 120..138

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 not render the buttons when disabled', () => {
        const value = [
            {
                label: 'First',
                name: 'first',
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 1 other location - About 5 hrs to fix
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 100..118

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

    it('should fire focus event', () => {
        const mockOnFocus = jest.fn();
        const component = mount(<MultiSelect onFocus={mockOnFocus} />);
        component.find(StyledButtonIcon).simulate('focus');
        expect(mockOnFocus).toHaveBeenCalledTimes(1);
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 2 other locations - About 2 hrs to fix
src/components/Lookup/__test__/selectedValue.spec.js on lines 35..40
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 93..98

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

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

    it('should fire blur event', () => {
        const mockOnBlur = jest.fn();
        const component = mount(<MultiSelect onBlur={mockOnBlur} />);
        component.find(StyledButtonIcon).simulate('blur');
        expect(mockOnBlur).toHaveBeenCalledTimes(1);
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 2 other locations - About 2 hrs to fix
src/components/Lookup/__test__/selectedValue.spec.js on lines 35..40
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 86..91

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

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

        const component = mount(
            <MultiSelect value={value} variant="chip">
                <Option name="first" label="First" />
                <Option name="second" label="Second" />
            </MultiSelect>,
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 4 other locations - About 1 hr to fix
src/components/MultiSelect/__test__/multiSelect.a11y.spec.js on lines 20..25
src/components/Table/__test__/table.spec.js on lines 234..239
src/components/Table/__test__/table.spec.js on lines 249..254
src/components/Table/__test__/table.spec.js on lines 311..316

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

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

    it('should render the placeholder when there is no selected items', () => {
        const component = mount(<MultiSelect placeholder="Placeholder text" />);
        expect(component.find(StyledPlaceholder).exists()).toBe(true);
    });
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 16 other locations - About 1 hr to fix
src/components/ButtonGroupPicker/__test__/buttonGroupPicker.spec.js on lines 47..50
src/components/ButtonIcon/__test__/buttonIcon.spec.js on lines 65..68
src/components/CheckboxGroup/__test__/checkboxGroup.spec.js on lines 55..58
src/components/CodeInput/__test__/codeInput.spec.js on lines 39..42
src/components/CodeInput/__test__/codeInput.spec.js on lines 47..50
src/components/FileSelector/__test__/fileSelector.spec.js on lines 57..60
src/components/Input/pickerInput/__test__/input.spec.js on lines 82..85
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 12..15
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 17..20
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 22..25
src/components/Option/__test__/option.spec.js on lines 131..134
src/components/RadioButtonGroup/__test__/radioButtonGroup.spec.js on lines 60..63
src/components/RadioGroup/__test__/radioGroup.spec.js on lines 39..42
src/components/Rating/__test__/rating.spec.js on lines 20..23
src/components/Slider/__test__/slider.spec.js on lines 34..37
src/components/WeekDayPicker/__test__/weekDayPicker.spec.js on lines 51..54

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

    it('should render Label when label prop is passed', () => {
        const component = mount(<MultiSelect label="Label" />);
        expect(component.find(Label).exists()).toBe(true);
    });
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 16 other locations - About 1 hr to fix
src/components/ButtonGroupPicker/__test__/buttonGroupPicker.spec.js on lines 47..50
src/components/ButtonIcon/__test__/buttonIcon.spec.js on lines 65..68
src/components/CheckboxGroup/__test__/checkboxGroup.spec.js on lines 55..58
src/components/CodeInput/__test__/codeInput.spec.js on lines 39..42
src/components/CodeInput/__test__/codeInput.spec.js on lines 47..50
src/components/FileSelector/__test__/fileSelector.spec.js on lines 57..60
src/components/Input/pickerInput/__test__/input.spec.js on lines 82..85
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 17..20
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 22..25
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 27..30
src/components/Option/__test__/option.spec.js on lines 131..134
src/components/RadioButtonGroup/__test__/radioButtonGroup.spec.js on lines 60..63
src/components/RadioGroup/__test__/radioGroup.spec.js on lines 39..42
src/components/Rating/__test__/rating.spec.js on lines 20..23
src/components/Slider/__test__/slider.spec.js on lines 34..37
src/components/WeekDayPicker/__test__/weekDayPicker.spec.js on lines 51..54

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

    it('should render a HelpText when bottomHelpText prop is passed', () => {
        const component = mount(<MultiSelect bottomHelpText="Help text" />);
        expect(component.find(HelpText).exists()).toBe(true);
    });
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 16 other locations - About 1 hr to fix
src/components/ButtonGroupPicker/__test__/buttonGroupPicker.spec.js on lines 47..50
src/components/ButtonIcon/__test__/buttonIcon.spec.js on lines 65..68
src/components/CheckboxGroup/__test__/checkboxGroup.spec.js on lines 55..58
src/components/CodeInput/__test__/codeInput.spec.js on lines 39..42
src/components/CodeInput/__test__/codeInput.spec.js on lines 47..50
src/components/FileSelector/__test__/fileSelector.spec.js on lines 57..60
src/components/Input/pickerInput/__test__/input.spec.js on lines 82..85
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 12..15
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 22..25
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 27..30
src/components/Option/__test__/option.spec.js on lines 131..134
src/components/RadioButtonGroup/__test__/radioButtonGroup.spec.js on lines 60..63
src/components/RadioGroup/__test__/radioGroup.spec.js on lines 39..42
src/components/Rating/__test__/rating.spec.js on lines 20..23
src/components/Slider/__test__/slider.spec.js on lines 34..37
src/components/WeekDayPicker/__test__/weekDayPicker.spec.js on lines 51..54

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

    it('should render a ErrorText when error prop is passed', () => {
        const component = mount(<MultiSelect error="Error text" />);
        expect(component.find(ErrorText).exists()).toBe(true);
    });
Severity: Major
Found in src/components/MultiSelect/__test__/multiSelect.spec.js and 16 other locations - About 1 hr to fix
src/components/ButtonGroupPicker/__test__/buttonGroupPicker.spec.js on lines 47..50
src/components/ButtonIcon/__test__/buttonIcon.spec.js on lines 65..68
src/components/CheckboxGroup/__test__/checkboxGroup.spec.js on lines 55..58
src/components/CodeInput/__test__/codeInput.spec.js on lines 39..42
src/components/CodeInput/__test__/codeInput.spec.js on lines 47..50
src/components/FileSelector/__test__/fileSelector.spec.js on lines 57..60
src/components/Input/pickerInput/__test__/input.spec.js on lines 82..85
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 12..15
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 17..20
src/components/MultiSelect/__test__/multiSelect.spec.js on lines 27..30
src/components/Option/__test__/option.spec.js on lines 131..134
src/components/RadioButtonGroup/__test__/radioButtonGroup.spec.js on lines 60..63
src/components/RadioGroup/__test__/radioGroup.spec.js on lines 39..42
src/components/Rating/__test__/rating.spec.js on lines 20..23
src/components/Slider/__test__/slider.spec.js on lines 34..37
src/components/WeekDayPicker/__test__/weekDayPicker.spec.js on lines 51..54

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

There are no issues that match your filters.

Category
Status