Vadimusss/project-lvl2-s413

View on GitHub

Showing 14 of 14 total issues

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

test.each([['json'], ['yml'], ['ini']])(
  'test gendiff + plain render with %s deepFile',
  (ext) => {
    const firstPath = `./__tests__/__fixtures__/beforeDeep.${ext}`;
    const secondPath = `./__tests__/__fixtures__/afterDeep.${ext}`;
Severity: Major
Found in __tests__/gendiff.test.js and 2 other locations - About 4 hrs to fix
__tests__/gendiff.test.js on lines 5..15
__tests__/gendiff.test.js on lines 29..39

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

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

test.each([['json'], ['yml'], ['ini']])(
  'test gendiff + default render with %s deepFile',
  (ext) => {
    const firstPath = `./__tests__/__fixtures__/beforeDeep.${ext}`;
    const secondPath = `./__tests__/__fixtures__/afterDeep.${ext}`;
Severity: Major
Found in __tests__/gendiff.test.js and 2 other locations - About 4 hrs to fix
__tests__/gendiff.test.js on lines 17..27
__tests__/gendiff.test.js on lines 29..39

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

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

test.each([['json'], ['yml'], ['ini']])(
  'test gendiff + json render with %s deepFile',
  (ext) => {
    const firstPath = `./__tests__/__fixtures__/beforeDeep.${ext}`;
    const secondPath = `./__tests__/__fixtures__/afterDeep.${ext}`;
Severity: Major
Found in __tests__/gendiff.test.js and 2 other locations - About 4 hrs to fix
__tests__/gendiff.test.js on lines 5..15
__tests__/gendiff.test.js on lines 17..27

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

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

  const unmodifiedList = nodeList
    .filter(value => value.type === 'unmodified')
    .reduce((acc, data) => {
      const newAcc = Object.assign(acc, { [data.name]: stringify(data.value) });
      return newAcc;
Severity: Major
Found in src/renderers/jsonRender.js and 3 other locations - About 2 hrs to fix
src/renderers/jsonRender.js on lines 26..31
src/renderers/jsonRender.js on lines 33..38
src/renderers/jsonRender.js on lines 40..45

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

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

  const modifiedList = nodeList
    .filter(value => value.type === 'modified')
    .reduce((acc, data) => {
      const newAcc = Object.assign(acc, { [data.name]: stringify(data.newValue) });
      return newAcc;
Severity: Major
Found in src/renderers/jsonRender.js and 3 other locations - About 2 hrs to fix
src/renderers/jsonRender.js on lines 26..31
src/renderers/jsonRender.js on lines 33..38
src/renderers/jsonRender.js on lines 47..52

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

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

  const deletedList = nodeList
    .filter(value => value.type === 'deleted')
    .reduce((acc, data) => {
      const newAcc = Object.assign(acc, { [data.name]: stringify(data.value) });
      return newAcc;
Severity: Major
Found in src/renderers/jsonRender.js and 3 other locations - About 2 hrs to fix
src/renderers/jsonRender.js on lines 26..31
src/renderers/jsonRender.js on lines 40..45
src/renderers/jsonRender.js on lines 47..52

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

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

  const addedList = nodeList
    .filter(value => value.type === 'added')
    .reduce((acc, data) => {
      const newAcc = Object.assign(acc, { [data.name]: stringify(data.value) });
      return newAcc;
Severity: Major
Found in src/renderers/jsonRender.js and 3 other locations - About 2 hrs to fix
src/renderers/jsonRender.js on lines 33..38
src/renderers/jsonRender.js on lines 40..45
src/renderers/jsonRender.js on lines 47..52

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

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 makeJSONRender has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const makeJSONRender = (ast) => {
  const nodeList = iter(ast);
  const addedList = nodeList
    .filter(value => value.type === 'added')
    .reduce((acc, data) => {
Severity: Minor
Found in src/renderers/jsonRender.js - About 1 hr to fix

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

    const added = (data, depth) => `${'    '
      .repeat(depth - 1)}  + ${data.name}: ${stringify(data.value, depth)}`;
    Severity: Major
    Found in src/renderers/treeRender.js and 2 other locations - About 55 mins to fix
    src/renderers/treeRender.js on lines 23..24
    src/renderers/treeRender.js on lines 29..30

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

    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

    const deleted = (data, depth) => `${'    '
      .repeat(depth - 1)}  - ${data.name}: ${stringify(data.value, depth)}`;
    Severity: Major
    Found in src/renderers/treeRender.js and 2 other locations - About 55 mins to fix
    src/renderers/treeRender.js on lines 23..24
    src/renderers/treeRender.js on lines 26..27

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

    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

    const unmodified = (data, depth) => `${'    '
      .repeat(depth - 1)}    ${data.name}: ${stringify(data.value, depth)}`;
    Severity: Major
    Found in src/renderers/treeRender.js and 2 other locations - About 55 mins to fix
    src/renderers/treeRender.js on lines 26..27
    src/renderers/treeRender.js on lines 29..30

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

    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

          if (!_.has(secondData, key)) {
            return acc.concat({ type: 'deleted', name: key, value: firstData[key] });
          }
    Severity: Minor
    Found in src/gendiff.js and 1 other location - About 40 mins to fix
    src/gendiff.js on lines 21..23

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

    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

          if (!_.has(firstData, key)) {
            return acc.concat({ type: 'added', name: key, value: secondData[key] });
          }
    Severity: Minor
    Found in src/gendiff.js and 1 other location - About 40 mins to fix
    src/gendiff.js on lines 17..19

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

    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

    Avoid too many return statements within this function.
    Open

          return acc.concat({ type: 'unmodified', name: key, value: secondData[key] });
    Severity: Major
    Found in src/gendiff.js - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language