nexxtway/react-rainbow

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

Summary

Maintainability
F
1 wk
Test Coverage

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

import {
    insertChildOrderly,
    getChildTabNodes,
    getTabIndexFromName,
    getChildrenTotalWidth,
Severity: Minor
Found in src/components/Tabset/__test__/utils.spec.js - About 3 hrs to fix

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

        describe('getChildTabNodes', () => {
            const elements = [
                { element: 'a', innerText: 'Julio' },
                { element: 'a', innerText: 'Pepe' },
            ];
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 2 other locations - About 6 hrs to fix
    src/components/InternalDropdown/helpers/__test__/getChildMenuItemNodes.spec.js on lines 3..21
    src/components/PrimitiveMenu/__test__/utils.spec.js on lines 52..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 172.

    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 return true when screen width is more than 600px and last tab is visible', () => {
                const activeTabName = 'pizza';
                const tabsetChildren = [
                    { name: 'pizza', ref: {} },
                    { name: 'onion', ref: {} },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 2 other locations - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 241..260
    src/components/Tabset/__test__/utils.spec.js on lines 281..300

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

    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 return true when screen width is less than 600px and last tab is active', () => {
                const activeTabName = 'tomato';
                const tabsetChildren = [
                    { name: 'pizza', ref: {} },
                    { name: 'onion', ref: {} },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 2 other locations - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 261..280
    src/components/Tabset/__test__/utils.spec.js on lines 281..300

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

    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 return false when screen width is more than 600px and last tab is not visible', () => {
                const activeTabName = 'pizza';
                const tabsetChildren = [
                    { name: 'pizza', ref: {} },
                    { name: 'onion', ref: {} },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 2 other locations - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 241..260
    src/components/Tabset/__test__/utils.spec.js on lines 261..280

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

    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 return true when a children in the tabset was changed in the same position', () => {
                const tabsetChildren = [
                    { props: { name: 'pizza' } },
                    { props: { name: 'onion' } },
                    { props: { name: 'tomato' } },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 1 other location - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 139..151

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

    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 return false when any children in tabset was changed in the same position', () => {
                const tabsetChildren = [
                    { props: { name: 'tomato' } },
                    { props: { name: 'pizza' } },
                    { props: { name: 'apple' } },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 1 other location - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 126..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 127.

    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 return true when screen width is more than 600px and first tab is visible', () => {
                const activeTabName = 'onion';
                const tabsetChildren = [
                    { name: 'pizza', ref: {} },
                    { name: 'onion', ref: {} },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 2 other locations - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 185..202
    src/components/Tabset/__test__/utils.spec.js on lines 221..238

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

    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 return true when screen width is less than 600px and first tab is active', () => {
                const activeTabName = 'pizza';
                const tabsetChildren = [
                    { name: 'pizza', ref: {} },
                    { name: 'onion', ref: {} },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 2 other locations - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 203..220
    src/components/Tabset/__test__/utils.spec.js on lines 221..238

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

    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 return false when screen width is more than 600px and first tab is not visible', () => {
                const activeTabName = 'onion';
                const tabsetChildren = [
                    { name: 'pizza', ref: {} },
                    { name: 'onion', ref: {} },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 2 other locations - About 4 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 185..202
    src/components/Tabset/__test__/utils.spec.js on lines 203..220

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

    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 return the right total children width in tabset when click the second tab', () => {
                const tabIndex = 1;
                const tabsetChildren = [
                    { name: 'pizza', ref: { offsetWidth: 1 } },
                    { name: 'onion', ref: { offsetWidth: 2 } },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 1 other location - About 3 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 115..123

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

    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 return 0 when click the first tab', () => {
                const tabIndex = 0;
                const tabsetChildren = [
                    { name: 'pizza', ref: { offsetWidth: 1 } },
                    { name: 'onion', ref: { offsetWidth: 2 } },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 1 other location - About 3 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 106..114

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

    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 return 0 when any children in tabset has width', () => {
                const tabsetChildren = [
                    { name: 'pizza', ref: { offsetWidth: 0 } },
                    { name: 'onion', ref: { offsetWidth: 0 } },
                    { name: 'tomato', ref: { offsetWidth: 0 } },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 1 other location - About 2 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 96..103

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

    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 return the right total children width in tabset', () => {
                const tabsetChildren = [
                    { name: 'pizza', ref: { offsetWidth: 1 } },
                    { name: 'onion', ref: { offsetWidth: 2 } },
                    { name: 'tomato', ref: { offsetWidth: 3 } },
    Severity: Major
    Found in src/components/Tabset/__test__/utils.spec.js and 1 other location - About 2 hrs to fix
    src/components/Tabset/__test__/utils.spec.js on lines 84..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 94.

    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