src/period/generators/__tests__/weekly.spec.js

Summary

Maintainability
D
2 days
Test Coverage

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

        it('should generate 53 periods for common years starting on Thursday', () => {
            // https://en.wikipedia.org/wiki/Common_year_starting_on_Thursday
            expect(generateWeeklyPeriodsForYear(1705)).toHaveLength(53)
            expect(generateWeeklyPeriodsForYear(2009)).toHaveLength(53)
            expect(generateWeeklyPeriodsForYear(2015)).toHaveLength(53)
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 2 other locations - About 3 hrs to fix
src/period/generators/__tests__/weekly.spec.js on lines 18..25
src/period/generators/__tests__/weekly.spec.js on lines 27..34

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

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 generate 53 periods for leap years starting on Thursday', () => {
            // https://en.wikipedia.org/wiki/Leap_year_starting_on_Thursday
            expect(generateWeeklyPeriodsForYear(1948)).toHaveLength(53)
            expect(generateWeeklyPeriodsForYear(1976)).toHaveLength(53)
            expect(generateWeeklyPeriodsForYear(2004)).toHaveLength(53)
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 2 other locations - About 3 hrs to fix
src/period/generators/__tests__/weekly.spec.js on lines 9..16
src/period/generators/__tests__/weekly.spec.js on lines 27..34

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

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 generate 53 periods for leap years starting on Wednesday', () => {
            // https://en.wikipedia.org/wiki/Leap_year_starting_on_Wednesday
            expect(generateWeeklyPeriodsForYear(1936)).toHaveLength(53)
            expect(generateWeeklyPeriodsForYear(1964)).toHaveLength(53)
            expect(generateWeeklyPeriodsForYear(1992)).toHaveLength(53)
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 2 other locations - About 3 hrs to fix
src/period/generators/__tests__/weekly.spec.js on lines 9..16
src/period/generators/__tests__/weekly.spec.js on lines 18..25

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

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 correct last week for 2015', () => {
            const weeksFor2015 = generateWeeklyPeriodsForYear(2015)

            expect(weeksFor2015[weeksFor2015.length - 1]).toEqual({
                startDate: '2015-12-28',
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 1 other location - About 1 hr to fix
src/period/generators/__tests__/weekly.spec.js on lines 95..104

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

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 correct last week for 2017', () => {
            const weeksFor2015 = generateWeeklyPeriodsForYear(2017)

            expect(weeksFor2015[weeksFor2015.length - 1]).toEqual({
                startDate: '2017-12-25',
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 1 other location - About 1 hr to fix
src/period/generators/__tests__/weekly.spec.js on lines 84..93

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

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

        it('should return the correct first week for 2014', () => {
            const weeksFor2014 = generateWeeklyPeriodsForYear(2014)

            expect(weeksFor2014[0]).toEqual({
                startDate: '2013-12-30',
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 5 other locations - About 1 hr to fix
src/period/generators/__tests__/daily.spec.js on lines 14..23
src/period/generators/__tests__/monthly.spec.js on lines 19..28
src/period/generators/__tests__/weekly.spec.js on lines 40..49
src/period/generators/__tests__/weekly.spec.js on lines 51..60
src/period/generators/__tests__/weekly.spec.js on lines 73..82

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

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

        it('should start the first week of 2015 in the previous year', () => {
            const weeksFor2015 = generateWeeklyPeriodsForYear(2015)

            expect(weeksFor2015[0]).toEqual({
                startDate: '2014-12-29',
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 5 other locations - About 1 hr to fix
src/period/generators/__tests__/daily.spec.js on lines 14..23
src/period/generators/__tests__/monthly.spec.js on lines 19..28
src/period/generators/__tests__/weekly.spec.js on lines 40..49
src/period/generators/__tests__/weekly.spec.js on lines 62..71
src/period/generators/__tests__/weekly.spec.js on lines 73..82

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

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

        it('should return the correct first week for 2004', () => {
            const weeksFor2004 = generateWeeklyPeriodsForYear(2004)

            expect(weeksFor2004[0]).toEqual({
                startDate: '2003-12-29',
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 5 other locations - About 1 hr to fix
src/period/generators/__tests__/daily.spec.js on lines 14..23
src/period/generators/__tests__/monthly.spec.js on lines 19..28
src/period/generators/__tests__/weekly.spec.js on lines 40..49
src/period/generators/__tests__/weekly.spec.js on lines 51..60
src/period/generators/__tests__/weekly.spec.js on lines 62..71

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

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

        it('should generate the correct result for each period', () => {
            const periods = generateWeeklyPeriodsForYear(2017)

            expect(periods[0]).toEqual({
                startDate: '2017-01-02',
Severity: Major
Found in src/period/generators/__tests__/weekly.spec.js and 5 other locations - About 1 hr to fix
src/period/generators/__tests__/daily.spec.js on lines 14..23
src/period/generators/__tests__/monthly.spec.js on lines 19..28
src/period/generators/__tests__/weekly.spec.js on lines 51..60
src/period/generators/__tests__/weekly.spec.js on lines 62..71
src/period/generators/__tests__/weekly.spec.js on lines 73..82

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

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