Showing 19 of 19 total issues
File skyway.routes.test.js
has 523 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-env jest */
'use strict'
const path = require('path')
const express = require('express')
Function getOperations
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Function exports
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = getDocs => {
const waitForDocs = getDocs.then(normalizeDocs)
waitForDocs.catch(err => {
debug('Invalid Schema', err)
Function schemaFromParams
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.schemaFromParams = (parameters, type) => {
return R.reduce(
(schema, param) => {
const key = R.prop('in', param)
const name = R.ifElse(
- Read upRead up
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
Open
exports.schemaFromParams = (parameters, type) => {
return R.reduce(
(schema, param) => {
const key = R.prop('in', param)
const name = R.ifElse(
Function context
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Avoid too many return
statements within this function. Open
Open
return {
username: creds.slice(0, index),
password: creds.slice(index + 1)
}
TODO found Open
Open
// TODO figure out how to have `application/json` as the key in parsers, but
- Exclude checks
TODO found Open
Open
// TODO this might break things... perhaps we should just use
- Exclude checks
TODO found Open
Open
// TODO response serialization
- Exclude checks
TODO found Open
Open
// TODO handle file type
- Exclude checks
TODO found Open
Open
// TODO there might be a lighter weight/faster csv parsing library. I was
- Exclude checks
TODO found Open
Open
// TODO regex can be slow... maybe there's a faster way of doing this?
- Exclude checks
TODO found Open
Open
// TODO response validation
- Exclude checks
TODO found Open
Open
// TODO make this configurable?
- Exclude checks
TODO found Open
Open
// TODO check scopes
- Exclude checks
TODO found Open
Open
// TODO regex can be slow... maybe there's a faster way of doing this?
- Exclude checks
TODO found Open
Open
// TODO this causes a validation error on the page because relative paths
- Exclude checks
TODO found Open
Open
// TODO make this more efficient if there is only one consumes
- Exclude checks