matteozambon89/trailpack-koa

View on GitHub

Showing 84 of 84 total issues

Function find has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  find(ctx, next) {
    const FootprintService = this.app.services.FootprintService
    const options = this.app.packs.koa.getOptionsFromQuery(this.query)
    const criteria = this.app.packs.koa.getCriteriaFromQuery(this.query)
    const id = ctx.params.id
Severity: Minor
Found in api/controllers/FootprintController.js - About 1 hr to fix

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

            allowHeaders: joi.alternatives()
              .try(
                joi.string(),
                joi.array()
                  .items(joi.string())
    Severity: Major
    Found in lib/schemas/config/web.js and 2 other locations - About 45 mins to fix
    lib/schemas/config/web.js on lines 155..160
    lib/schemas/config/web.js on lines 161..166

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

    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

            exposeHeaders: joi.alternatives()
              .try(
                joi.string(),
                joi.array()
                  .items(joi.string())
    Severity: Major
    Found in lib/schemas/config/web.js and 2 other locations - About 45 mins to fix
    lib/schemas/config/web.js on lines 155..160
    lib/schemas/config/web.js on lines 167..172

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

    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 deeply nested control flow statements.
    Open

            if (!customMiddlewares) {
              return
            }
    Severity: Major
    Found in lib/server.js - About 45 mins to fix

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

              allowMethods: joi.alternatives()
                .try(
                  joi.string(),
                  joi.array()
                    .items(joi.string())
      Severity: Major
      Found in lib/schemas/config/web.js and 2 other locations - About 45 mins to fix
      lib/schemas/config/web.js on lines 161..166
      lib/schemas/config/web.js on lines 167..172

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

      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 (childId) {
            response = FootprintService.findAssociation(
              parentModel,
              parentId,
              childAttribute,
      Severity: Minor
      Found in api/controllers/FootprintController.js and 1 other location - About 40 mins to fix
      api/controllers/FootprintController.js on lines 286..303

      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 (childId) {
            response = FootprintService.destroyAssociation(
              parentModel,
              parentId,
              childAttribute,
      Severity: Minor
      Found in api/controllers/FootprintController.js and 1 other location - About 40 mins to fix
      api/controllers/FootprintController.js on lines 191..208

      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

        onError: joi.alternatives()
          .try(
            joi.boolean(),
            joi.func()
          )
      Severity: Minor
      Found in lib/schemas/config/web.js and 1 other location - About 30 mins to fix
      lib/schemas/config/socket.js on lines 33..38

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

      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

        cluster: joi.alternatives()
          .try(
            joi.object(),
            joi.boolean()
          )
      Severity: Minor
      Found in lib/schemas/config/socket.js and 1 other location - About 30 mins to fix
      lib/schemas/config/web.js on lines 117..122

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

      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

      Parsing error: The keyword 'const' is reserved
      Open

      const joi = require('joi')
      Severity: Minor
      Found in lib/schemas/config/socket.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Fenced code blocks should be surrounded by blank lines
      Open

      ```sh
      Severity: Info
      Found in README.md by markdownlint

      MD031 - Fenced code blocks should be surrounded by blank lines

      Tags: code, blank_lines

      Aliases: blanks-around-fences

      This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:

      Some text
      ```
      Code block
      ```
      
      ```
      Another code block
      ```
      Some more text

      To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      ```
      Code block
      ```
      
      ```
      Another code block
      ```
      
      Some more text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.

      Parsing error: The keyword 'const' is reserved
      Open

      const joi = require('joi')
      Severity: Minor
      Found in lib/validator.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const ServerTrailpack = require('trailpack/server')
      Severity: Minor
      Found in index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const _ = require('lodash')
      Severity: Minor
      Found in api/policies/FootprintPolicy.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const format = require('string-template')
      Severity: Minor
      Found in lib/utils.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Trailing punctuation in header
      Open

      ## Did you like my work?
      Severity: Info
      Found in README.md by markdownlint

      MD026 - Trailing punctuation in header

      Tags: headers

      Aliases: no-trailing-punctuation

      Parameters: punctuation (string; default ".,;:!?")

      This rule is triggered on any header that has a punctuation character as the last character in the line:

      # This is a header.

      To fix this, remove any trailing punctuation:

      # This is a header

      Note: The punctuation parameter can be used to specify what characters class as punctuation at the end of the header. For example, you can set it to '.,;:!' to allow headers with question marks in them, such as might be used in an FAQ.

      Fenced code blocks should be surrounded by blank lines
      Open

      ```

      MD031 - Fenced code blocks should be surrounded by blank lines

      Tags: code, blank_lines

      Aliases: blanks-around-fences

      This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:

      Some text
      ```
      Code block
      ```
      
      ```
      Another code block
      ```
      Some more text

      To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      ```
      Code block
      ```
      
      ```
      Another code block
      ```
      
      Some more text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.

      Parsing error: The keyword 'const' is reserved
      Open

      const joi = require('joi')
      Severity: Minor
      Found in lib/schemas/config/web.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const joi = require('joi')
      Severity: Minor
      Found in lib/schemas/route/handler/serve.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Parsing error: The keyword 'const' is reserved
      Open

      const joi = require('joi')
      Severity: Minor
      Found in lib/schemas/config/main.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Severity
      Category
      Status
      Source
      Language