lib/common/route.js
File route.js
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const _ = require('lodash');
const Promise = require('bluebird');
const EventEmitter = require('events-bluebird');
Function build
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Route.prototype.build = function() {
const self = this;
this.emit('build');
Function acceptsContentType
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Route.prototype.acceptsContentType = function(type, options, parser) {
type = typeis.normalize(type);
if (this.$dataParserMiddleware === null) {
Function callback
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function callback(req, res, next) {
//per request unique context object
var reqContext = Object.create(Object.prototype, {
route: {
Function Route
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Route(options) {
var defaults = {
name: null,
url: null,
summary: "",
Function applyCatchList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function applyCatchList(promise, req, res, catchList, index) {
Function respondsWith
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
Route.prototype.respondsWith = function(descriptor) {
var responses = this.description.responses;
var code = 200;
if (descriptor instanceof Function
- 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"