packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js

Summary

Maintainability
F
2 wks
Test Coverage

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

import FixedPeriodsGenerator from '../FixedPeriodsGenerator';

describe('FixedPeriodsGenerator class', () => {
    const periodsGenerator = new FixedPeriodsGenerator();

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

        describe('Six-monthly April period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get('Six-monthly April');
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 37..73
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 217..253
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 255..291
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 341..377
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 379..415

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

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

        describe('Monthly period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get('Monthly');
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 37..73
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 217..253
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 341..377
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 379..415
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 417..453

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

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

        describe('Daily period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get('Daily');
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 217..253
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 255..291
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 341..377
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 379..415
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 417..453

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

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

        describe('Bi-weekly period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get('Bi-weekly');
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 37..73
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 255..291
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 341..377
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 379..415
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 417..453

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

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

        describe('Six-monthly period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get('Six-monthly');
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 37..73
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 217..253
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 255..291
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 341..377
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 417..453

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

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

        describe('Quarterly period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get('Quarterly');
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 37..73
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 217..253
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 255..291
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 379..415
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 417..453

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

    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

        describe('Financial November period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get(
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 531..567
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 569..605
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 607..643

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

    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

        describe('Financial April period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get(
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 493..529
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 531..567
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 569..605

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

    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

        describe('Financial October period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get(
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 493..529
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 569..605
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 607..643

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

    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

        describe('Financial July period generator', () => {
            let periods;
    
            beforeAll(() => {
                const generator = periodsGenerator.get(
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 493..529
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 531..567
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 607..643

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

    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

            describe('-> Weekly Wednesday', () => {
                beforeAll(() => {
                    const generator = periodsGenerator.get('Weekly (Start Wednesday)');
    
                    periods = generator.generatePeriods({
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 138..162
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 164..188
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 190..214

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

    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

            describe('-> Weekly Saturday', () => {
                beforeAll(() => {
                    const generator = periodsGenerator.get('Weekly (Start Saturday)');
    
                    periods = generator.generatePeriods({
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 112..136
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 138..162
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 190..214

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

    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

            describe('-> Weekly Thursday', () => {
                beforeAll(() => {
                    const generator = periodsGenerator.get('Weekly (Start Thursday)');
    
                    periods = generator.generatePeriods({
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 112..136
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 164..188
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 190..214

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

    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

            describe('-> Weekly Sunday', () => {
                beforeAll(() => {
                    const generator = periodsGenerator.get('Weekly (Start Sunday)');
    
                    periods = generator.generatePeriods({
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 112..136
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 138..162
    packages/period-selector-dialog/src/modules/__tests__/FixedPeriodsGenerator.spec.js on lines 164..188

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

    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