nexxtway/react-rainbow

View on GitHub
src/components/Tabset/__test__/tabset.spec.js

Summary

Maintainability
F
6 days
Test Coverage

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

import React from 'react';
import { mount } from 'enzyme';
import Tabset from '../index';
import Tab from '../../Tab';
import {
Severity: Minor
Found in src/components/Tabset/__test__/tabset.spec.js - About 2 hrs to fix

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

        it('should set the right scroll motion when click on a tab that is out of view on the right side', () => {
            getChildrenTotalWidthUpToClickedTab.mockReset();
            getChildrenTotalWidthUpToClickedTab.mockReturnValue(500);
            getTabIndexFromName.mockReset();
            getTabIndexFromName.mockReturnValue(2);
    Severity: Major
    Found in src/components/Tabset/__test__/tabset.spec.js and 1 other location - About 1 day to fix
    src/components/Tabset/__test__/tabset.spec.js on lines 214..235

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

    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 set the right scroll motion when click on a tab that is out of view on the left side', () => {
            getChildrenTotalWidthUpToClickedTab.mockReset();
            getChildrenTotalWidthUpToClickedTab.mockReturnValue(400);
            getTabIndexFromName.mockReset();
            getTabIndexFromName.mockReturnValue(2);
    Severity: Major
    Found in src/components/Tabset/__test__/tabset.spec.js and 1 other location - About 1 day to fix
    src/components/Tabset/__test__/tabset.spec.js on lines 236..257

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

    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 set the right button disabled to true', () => {
            getRightButtonDisabledState.mockReset();
            getRightButtonDisabledState.mockReturnValue(true);
            const component = mount(
                <Tabset activeTabName="tab-1">
    Severity: Major
    Found in src/components/Tabset/__test__/tabset.spec.js and 1 other location - About 1 day to fix
    src/components/Tabset/__test__/tabset.spec.js on lines 128..141

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

    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 set the left button disabled to true', () => {
            getLeftButtonDisabledState.mockReset();
            getLeftButtonDisabledState.mockReturnValue(true);
            const component = mount(
                <Tabset activeTabName="tab-1">
    Severity: Major
    Found in src/components/Tabset/__test__/tabset.spec.js and 1 other location - About 1 day to fix
    src/components/Tabset/__test__/tabset.spec.js on lines 142..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 199.

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

            component.instance().tabsetChildren = [
                <Tab label="Tab-1" name="tab-1" registerTab={registerTabMockFn} />,
                <Tab label="Tab-2" name="tab-2" registerTab={registerTabMockFn} />,
                <Tab label="Tab-3" name="tab-3" registerTab={registerTabMockFn} />,
            ];
    Severity: Major
    Found in src/components/Tabset/__test__/tabset.spec.js and 1 other location - About 2 hrs to fix
    src/components/Tabset/__test__/tabset.spec.js on lines 167..171

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

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

            component.instance().tabsetChildren = [
                <Tab label="Tab-1" name="tab-1" registerTab={registerTabMockFn} />,
                <Tab label="Tab-2" name="tab-2" registerTab={registerTabMockFn} />,
                <Tab label="Tab-3" name="tab-3" registerTab={registerTabMockFn} />,
            ];
    Severity: Major
    Found in src/components/Tabset/__test__/tabset.spec.js and 1 other location - About 2 hrs to fix
    src/components/Tabset/__test__/tabset.spec.js on lines 117..121

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

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

        it('should render the children passed', () => {
            const component = mount(
                <Tabset>
                    <p>testing tabset</p>
                </Tabset>,
    Severity: Major
    Found in src/components/Tabset/__test__/tabset.spec.js and 3 other locations - About 2 hrs to fix
    src/components/Sidebar/__test__/sidebar.spec.js on lines 6..13
    src/components/VerticalNavigation/__test__/verticalNavigation.spec.js on lines 13..20
    src/components/VerticalSectionOverflow/__test__/verticalSectionOverflow.spec.js on lines 63..70

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

    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