Showing 54 of 94 total issues
Function action
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
filter.action = (request, response, callback) => {
const filters = request.processedFilter
if (!filters) return callback()
if (Array.isArray(response.data)) {
- 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 _generateDataItem
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
responseHelper._generateDataItem = (item, schema) => {
const isSpecialProperty = value => {
if (!(value instanceof Object)) return false
if (value._settings) return true
return false
- 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 simpleAttribute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
joiConverter.simpleAttribute = joiScheme => {
let type = joiScheme._type
if (type === 'any') {
// { _valids: { _set: [ 'M', 'F' ] } }
type = typeof (joiScheme._valids._set || [ ])[0]
Function action
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
sort.action = (request, response, callback) => {
let attribute = request.params.sort
let ascending = 1
if (!attribute) return callback()
attribute = (`${attribute}`)
Function lowerAction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ChainHandler.prototype[lowerAction] = function (request) {
const self = this
const argsIn = Array.prototype.slice.call(arguments)
const callback = argsIn.pop()
// This block catches invocations to synchronous functions (.initialise())
Function _parseFilterElementHelper
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
filter._parseFilterElementHelper = (attributeConfig, filterElement) => {
if (!filterElement) return { error: 'invalid or empty filter element' }
const parsedElements = [].concat(filterElement).map(scalarElement => filter._parseScalarFilterElement(attributeConfig, scalarElement))
- 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 action
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
sort.action = (request, response, callback) => {
let attribute = request.params.sort
let ascending = 1
if (!attribute) return callback()
attribute = (`${attribute}`)
- 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 _addDeepPaths
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
swaggerPaths._addDeepPaths = (paths, resourceName, resourceConfig, relationName, relation) => {
const relationType = resourceConfig.attributes[relationName]._settings.__many ? 'many' : 'one'
if (resourceConfig.handlers.find) {
paths[`/${resourceName}/{id}/${relationName}`] = {
- 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
Avoid too many return
statements within this function. Open
return null
Avoid too many return
statements within this function. Open
return { error: validateResult.error.message }
Avoid too many return
statements within this function. Open
return { result: validatedElement }
Function swap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
joiConverter.swap = (joiScheme, graphQlResources) => {
let type
if (!joiScheme._settings) {
type = joiConverter.simpleAttribute(joiScheme)
} else {
- 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 route
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
rerouter.route = (newRequest, callback) => {
const validRoutes = router._routes[newRequest.method.toLowerCase()]
const path = rerouter._generateSanePath(newRequest)
const route = rerouter._pickFirstMatchingRoute(validRoutes, path)
- 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 _mergeParams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
rerouter._mergeParams = (objA, objB) => {
if (!objB) return objA
Object.keys(objA).forEach(someKey => {
if (!objB[someKey]) {
objB[someKey] = objA[someKey]
- 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"