echonok/project-lvl2-s333

View on GitHub

Showing 20 of 20 total issues

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

  it('#gen-diff YAML -> plain structure', () => {
    const actual = genDiff(path1ymlComplex, path2ymlComplex, 'plain');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_plain_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff JSON -> JSON', () => {
    const actual = genDiff(path1json, path2json, 'json');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_json');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff INI -> plain structure', () => {
    const actual = genDiff(path1iniComplex, path2iniComplex, 'plain');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_plain_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff YAML -> structure', () => {
    const actual = genDiff(path1yml, path2yml, 'structure');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_structure');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff JSON -> JSON', () => {
    const actual = genDiff(path1jsonComplex, path2jsonComplex, 'json');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_json_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff INI -> JSON', () => {
    const actual = genDiff(path1iniComplex, path2iniComplex, 'json');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_json_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..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 74.

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

  it('#gen-diff INI -> JSON', () => {
    const actual = genDiff(path1ini, path2ini, 'json');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_json');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff JSON -> structure', () => {
    const actual = genDiff(path1json, path2json, 'structure');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_structure');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff YAML -> structure', () => {
    const actual = genDiff(path1ymlComplex, path2ymlComplex, 'structure');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_structure_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff INI -> structure', () => {
    const actual = genDiff(path1ini, path2ini, 'structure');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_structure');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff YAML -> JSON', () => {
    const actual = genDiff(path1yml, path2yml, 'json');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_json');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff YAML -> JSON', () => {
    const actual = genDiff(path1ymlComplex, path2ymlComplex, 'json');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_json_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff JSON -> plain structure', () => {
    const actual = genDiff(path1json, path2json, 'plain');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_plain');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff JSON -> structure', () => {
    const actual = genDiff(path1jsonComplex, path2jsonComplex, 'structure');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_structure_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff JSON -> plain structure', () => {
    const actual = genDiff(path1jsonComplex, path2jsonComplex, 'plain');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_plain_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff INI -> structure', () => {
    const actual = genDiff(path1iniComplex, path2iniComplex, 'structure');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_structure_complex');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff YAML -> plain structure', () => {
    const actual = genDiff(path1yml, path2yml, 'plain');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_plain');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 59..64
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

  it('#gen-diff INI -> plain structure', () => {
    const actual = genDiff(path1ini, path2ini, 'plain');
    const expectedFixturePath = path.join(__dirname, '__fixtures__', 'expected_plain');
    const expected = fs.readFileSync(expectedFixturePath, 'utf-8');
    expect(actual).toEqual(expected);
Severity: Major
Found in __tests__/gen-diff-test.js and 17 other locations - About 1 hr to fix
__tests__/gen-diff-test.js on lines 24..29
__tests__/gen-diff-test.js on lines 31..36
__tests__/gen-diff-test.js on lines 38..43
__tests__/gen-diff-test.js on lines 45..50
__tests__/gen-diff-test.js on lines 52..57
__tests__/gen-diff-test.js on lines 66..71
__tests__/gen-diff-test.js on lines 73..78
__tests__/gen-diff-test.js on lines 80..85
__tests__/gen-diff-test.js on lines 87..92
__tests__/gen-diff-test.js on lines 94..99
__tests__/gen-diff-test.js on lines 101..106
__tests__/gen-diff-test.js on lines 108..113
__tests__/gen-diff-test.js on lines 115..120
__tests__/gen-diff-test.js on lines 122..127
__tests__/gen-diff-test.js on lines 129..134
__tests__/gen-diff-test.js on lines 136..141
__tests__/gen-diff-test.js on lines 143..148

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

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

Function compareTwoData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const compareTwoData = (data1, data2) => getAllKeys(data1, data2).map((key) => {
  const value1 = data1[key];
  const value2 = data2[key];

  if (_.isObject(value1) && _.isObject(value2)) {
Severity: Minor
Found in src/index.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid too many return statements within this function.
Open

  return {
    name: key, type: 'changed', value1, value2,
  };
Severity: Major
Found in src/index.js - About 30 mins to fix
    Severity
    Category
    Status
    Source
    Language