ksmithut/skyway

View on GitHub

Showing 7 of 19 total issues

File skyway.routes.test.js has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-env jest */
'use strict'

const path = require('path')
const express = require('express')
Severity: Major
Found in swagger2/__tests__/skyway.routes.test.js - About 1 day to fix

    Function getOperations has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getOperations = docs => {
      const paths = R.prop('paths', docs)
      const rootProduces = R.prop('produces', docs)
      const rootConsumes = R.prop('consumes', docs)
      const rootSecurity = R.prop('security', docs)
    Severity: Major
    Found in swagger2/routes/normalize-docs/normalize-docs.js - About 2 hrs to fix

      Function exports has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = getDocs => {
        const waitForDocs = getDocs.then(normalizeDocs)
      
        waitForDocs.catch(err => {
          debug('Invalid Schema', err)
      Severity: Minor
      Found in swagger2/routes/routes.js - About 2 hrs to fix

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

        exports.schemaFromParams = (parameters, type) => {
          return R.reduce(
            (schema, param) => {
              const key = R.prop('in', param)
              const name = R.ifElse(
        Severity: Minor
        Found in swagger2/routes/ajv-swagger/ajv-swagger.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 schemaFromParams has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.schemaFromParams = (parameters, type) => {
          return R.reduce(
            (schema, param) => {
              const key = R.prop('in', param)
              const name = R.ifElse(
        Severity: Minor
        Found in swagger2/routes/ajv-swagger/ajv-swagger.js - About 1 hr to fix

          Function context has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.context = (options, docs) => {
            const securityHandlers = R.pathOr({}, ['security'], options)
            const securityDefinitions = R.pathOr({}, ['securityDefinitions'], docs)
            const handlers = R.mapObjIndexed((definition, key) => {
              const handler = R.propOr(notImplemented, key, securityHandlers)
          Severity: Minor
          Found in swagger2/routes/security/security.js - About 1 hr to fix

            Avoid too many return statements within this function.
            Open

              return {
                username: creds.slice(0, index),
                password: creds.slice(index + 1)
              }
            Severity: Major
            Found in swagger2/routes/security/auth/basic.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language