igakim/project-lvl3-s370

View on GitHub

Showing 7 of 7 total issues

Function pageLoader has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const pageLoader = (pageUrl, options = {}) => {
  const directory = options.output || '.';
  const { host, pathname, protocol } = url.parse(pageUrl);
  const fileName = getResourceName(path.join(host, pathname), '.html'); // hexlet-io-courses.html
  const assetsDirectoryName = getResourceName(path.join(host, pathname), '_files'); // hexlet-io-courses_files
Severity: Minor
Found in src/index.js - About 1 hr to fix

    Function getResourcesLinks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const getResourcesLinks = ($, defaultUrl) => {
      const tagsNames = Object.keys(tags);
      const allLinks = tagsNames
        .map(tag => $(tag)
          .map((i, el) => {
    Severity: Minor
    Found in src/utils.js - About 1 hr to fix

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

        nock(host)
          .defaultReplyHeaders({ 'access-control-allow-origin': '*' })
          .get('/assets/js/script.js')
          .replyWithFile(200, path.join(__dirname, '__fixtures__/assets/js/script.js'));
      Severity: Major
      Found in __tests__/page-laoder.test.js and 4 other locations - About 35 mins to fix
      __tests__/page-laoder.test.js on lines 29..32
      __tests__/page-laoder.test.js on lines 33..36
      __tests__/page-laoder.test.js on lines 41..44
      __tests__/page-laoder.test.js on lines 45..48

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

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

        nock(host)
          .defaultReplyHeaders({ 'access-control-allow-origin': '*' })
          .get('/assets/img/1.png')
          .replyWithFile(200, path.join(__dirname, '__fixtures__/assets/img/1.png'));
      Severity: Major
      Found in __tests__/page-laoder.test.js and 4 other locations - About 35 mins to fix
      __tests__/page-laoder.test.js on lines 29..32
      __tests__/page-laoder.test.js on lines 33..36
      __tests__/page-laoder.test.js on lines 37..40
      __tests__/page-laoder.test.js on lines 45..48

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

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

        nock(host)
          .defaultReplyHeaders({ 'access-control-allow-origin': '*' })
          .get('/assets/main.css')
          .replyWithFile(200, path.join(__dirname, '__fixtures__/assets/main.css'));
      Severity: Major
      Found in __tests__/page-laoder.test.js and 4 other locations - About 35 mins to fix
      __tests__/page-laoder.test.js on lines 29..32
      __tests__/page-laoder.test.js on lines 37..40
      __tests__/page-laoder.test.js on lines 41..44
      __tests__/page-laoder.test.js on lines 45..48

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

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

        nock(host)
          .defaultReplyHeaders({ 'access-control-allow-origin': '*' })
          .get('/assets/style.css')
          .replyWithFile(200, path.join(__dirname, '__fixtures__/assets/style.css'));
      Severity: Major
      Found in __tests__/page-laoder.test.js and 4 other locations - About 35 mins to fix
      __tests__/page-laoder.test.js on lines 33..36
      __tests__/page-laoder.test.js on lines 37..40
      __tests__/page-laoder.test.js on lines 41..44
      __tests__/page-laoder.test.js on lines 45..48

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

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

        nock(cdnHost)
          .defaultReplyHeaders({ 'access-control-allow-origin': '*' })
          .get('/assets/essential-476044e86044baa43c1b5a57ffdcb6a8c8853888ec074dc6a5ac5b8141bfd1e6.js')
          .replyWithFile(200, path.join(__dirname, '__fixtures__/assets/js/script.js'));
      Severity: Major
      Found in __tests__/page-laoder.test.js and 4 other locations - About 35 mins to fix
      __tests__/page-laoder.test.js on lines 29..32
      __tests__/page-laoder.test.js on lines 33..36
      __tests__/page-laoder.test.js on lines 37..40
      __tests__/page-laoder.test.js on lines 41..44

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

      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

      Severity
      Category
      Status
      Source
      Language