Showing 14 of 84 total issues
Function _generateKoaRoute
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
_generateKoaRoute (app, koa, router, route) {
// Make sure url params are defined as:
// :x
// instead of
// {x}
- 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 _createWebServer
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_createWebServer(app, koa) {
return new Promise((resolve, reject) => {
let nativeServer
let serverType
File server.js
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* @Author: Matteo Zambon <Matteo>
* @Date: 2018-02-15 09:55:24
* @Last modified by: Matteo
* @Last modified time: 2018-02-18 04:43:44
Function _generateKoaRoute
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_generateKoaRoute (app, koa, router, route) {
// Make sure url params are defined as:
// :x
// instead of
// {x}
Function registerFeatures
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
registerFeatures (app, koa) {
// Set onError handler, if function is specified
if (typeof app.config.web.onError === 'function') {
koa.context.onerror = app.config.web.onError
}
- 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
File FootprintController.js
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* @Author: Matteo Zambon <Matteo>
* @Date: 2018-02-12 11:41:41
* @Last modified by: Matteo
* @Last modified time: 2018-02-18 01:20:29
Function findAssociation
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
findAssociation(ctx, next) {
const FootprintService = this.app.services.FootprintService
const options = this.app.packs.koa.getOptionsFromQuery(this.query)
const criteria = this.app.packs.koa.getCriteriaFromQuery(this.query)
const parentModel = ctx.params.parentModel
Function updateAssociation
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateAssociation(ctx, next) {
const req = ctx.request
const FootprintService = this.app.services.FootprintService
const options = this.app.packs.koa.getOptionsFromQuery(this.query)
Function registerFeatures
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
registerFeatures (app, koa) {
// Set onError handler, if function is specified
if (typeof app.config.web.onError === 'function') {
koa.context.onerror = app.config.web.onError
}
Function destroyAssociation
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
destroyAssociation(ctx, next) {
const FootprintService = this.app.services.FootprintService
const options = this.app.packs.koa.getOptionsFromQuery(this.query)
const criteria = this.app.packs.koa.getCriteriaFromQuery(this.query)
const parentModel = ctx.params.parentModel
Function _registerRoutes
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_registerRoutes(app, koa) {
// Reverse routes to have parametrized routes first
const routes = app.routes.reverse()
const router = new KoaRouter()
Function update
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
update(ctx, next) {
const req = ctx.request
const FootprintService = this.app.services.FootprintService
const options = this.app.packs.koa.getOptionsFromQuery(this.query)
Function find
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
find(ctx, next) {
const FootprintService = this.app.services.FootprintService
const options = this.app.packs.koa.getOptionsFromQuery(this.query)
const criteria = this.app.packs.koa.getCriteriaFromQuery(this.query)
const id = ctx.params.id
Avoid deeply nested control flow statements. Open
Open
if (!customMiddlewares) {
return
}