Function registerRoutes
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerRoutes(app, server) {
// Sort the routes so that they are always in the correct express order.
const routes = app.routes.sort(utils.createSpecificityComparator({ order: 'asc' }))
const express = app.config.get('web.express')
const expressRouter = express.Router
Function registerMiddlewares
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
registerMiddlewares(app, server) {
server.use(expressBoom())
if (this.cors) {
server.use(cors(this.cors === true ? {} : this.cors))
}
- 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 registerViews
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
registerViews(app, server) {
const viewEngine = app.config.get('views.engine') || null
const viewEngines = app.config.get('web.views')
if (!viewEngine && !viewEngines) {
- 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 createServer
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
createServer(app) {
const main = app.config.get('main')
const sess = app.config.get('session')
const express = app.config.get('web.express')
File server.js
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint no-console: [0] */
'use strict'
const _ = require('lodash')
const path = require('path')
Function registerMiddlewares
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerMiddlewares(app, server) {
server.use(expressBoom())
if (this.cors) {
server.use(cors(this.cors === true ? {} : this.cors))
}
Function createServer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
createServer(app) {
const main = app.config.get('main')
const sess = app.config.get('session')
const express = app.config.get('web.express')
- 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"