jaumard/trailpack-design-first

View on GitHub

Showing 7 of 15 total issues

Function _getJoiValidation has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _getJoiValidation(description) {
    if (!description) {
      return null
    }
    let type = description.type
Severity: Major
Found in lib/util.js - About 3 hrs to fix

    File util.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const { promisify } = require('util')
    const exists = promisify(require('fs').exists)
    const Joi = require('joi')
    const path = require('path')
    const SwaggerParser = require('swagger-parser')
    Severity: Minor
    Found in lib/util.js - About 3 hrs to fix

      Function _mapValidations has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _mapValidations(definition, methodDefinition) {
          const validation = {}
          const headersValidation = {}
          const queryValidation = {}
          const paramsValidation = {}
      Severity: Major
      Found in lib/util.js - About 2 hrs to fix

        Function setupApiFromDefinition has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          setupApiFromDefinition(definition, app) {
            const operations = definition.paths
            const basePath = definition.basePath
            const baseSecurity = definition.security
            const securityDefinitions = definition.securityDefinitions
        Severity: Major
        Found in lib/util.js - About 2 hrs to fix

          Function _mapValidations has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            _mapValidations(definition, methodDefinition) {
              const validation = {}
              const headersValidation = {}
              const queryValidation = {}
              const paramsValidation = {}
          Severity: Minor
          Found in lib/util.js - About 2 hrs 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

          Function _getJoiValidation has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            _getJoiValidation(description) {
              if (!description) {
                return null
              }
              let type = description.type
          Severity: Minor
          Found in lib/util.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

          Function setupSwaggerExposition has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            setupSwaggerExposition(app) {
              const definitionFiles = app.config.swagger.swaggerDefinition
              if (Array.isArray(definitionFiles)) {
                const folders = []
                definitionFiles.map(definitionFile => {
          Severity: Minor
          Found in lib/util.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language