landrail8/project-lvl2-s213

View on GitHub

Showing 6 of 6 total issues

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

test('compare two yaml-files', () => {
  expect(f('./__tests__/__fixtures__/before.yaml', './__tests__/__fixtures__/after.yaml')).toEqual({
    '  host': 'hexlet.io',
    '+ timeout': 20,
    '- timeout': 50,
Severity: Major
Found in __tests__/compareTest.js and 1 other location - About 1 hr to fix
__tests__/compareTest.js on lines 4..12

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

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

test('compare two json-files', () => {
  expect(f('./__tests__/__fixtures__/before.json', './__tests__/__fixtures__/after.json')).toEqual({
    '  host': 'hexlet.io',
    '+ timeout': 20,
    '- timeout': 50,
Severity: Major
Found in __tests__/compareTest.js and 1 other location - About 1 hr to fix
__tests__/compareTest.js on lines 14..22

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

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

const f = (file1, file2) => {
  // получим содержание файлов как текст
  // в дальнейшем можно будет вынести это в отдельный модуль,
  // чтобы алгоритм сравнения получал на вход всегда готовые объекты
  // это нужно для отработки других кейсов - например, если к сравнению придет текст, а не файлы
Severity: Minor
Found in src/compare.js - About 1 hr to fix

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

        if ((obj2[currentValue] !== undefined)
          && (obj1[currentValue] === undefined)) {
          return { ...acc, [`+ ${currentValue}`]: obj2[currentValue] };
        }
    Severity: Minor
    Found in src/compare.js and 1 other location - About 50 mins to fix
    src/compare.js on lines 39..42

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

    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 ((obj1[currentValue] !== undefined)
          && (obj2[currentValue] === undefined)) {
          return { ...acc, [`- ${currentValue}`]: obj1[currentValue] };
        }
    Severity: Minor
    Found in src/compare.js and 1 other location - About 50 mins to fix
    src/compare.js on lines 44..47

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

    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;
    Severity: Major
    Found in src/compare.js - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language