Showing 51 of 90 total issues
Function insertOne
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
insertOne (data/*, options*/) {
return new Promise((resolve, reject) => {
var timer = this._createTimer('insertOne');
Function load
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
load () {
return new Promise((resolve, reject) => {
getConfigFromConsul(this._logger, this._options)
.then((config) => {
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (di, config) {
var app = express();
app.di = di;
Function _init
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_init () {
var that = this;
var makeSimpleStep = function (stepName) {
return function (value) {
Function create
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create (data, options) {
return new Promise((resolve, reject) => {
var timer = this._createTimer(this.entity + ':create');
Function exports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (logger) {
return function (error, req, res, next) {
if (error) {
- 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 exports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (logger, di, apiClasses, createFunctions) {
var original = {
di: di,
- 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 check
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
check (logger) {
if (this._entity && this._error.entity !== this._entity) {
return false;
}
Function insertOne
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
insertOne (data, options) {
return new Promise((resolve, reject) => {
var timer = this._createTimer('insertOne');
Function badRequest
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
helpers.badRequest = function (error) {
var message = 'Bad Request';
var code = null;
var list = [];
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (init) {
return function (logger, config, originalDi) {
return new Promise((resolve, reject) => {
Function findOneAndUpdate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
findOneAndUpdate (filter, update, options) {
var timer = this._createTimer('findOneAndUpdate');
if (!options) {
Function post
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
post (url, body, options) {
return new Promise((resolve, reject) => {
var timer = this._createTimer('post');
Function getConsulKey
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var getConsulKey = function (logger, key, options) {
return new Promise((resolve, reject) => {
var url = `http://${options.host}:${options.port}/v1/kv/${key}`;
Function findOne
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
findOne (filters, fields) {
var timer = this._createTimer(this.entity + ':findOne');
timer.data = {
Function ensureIndexes
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ensureIndexes () {
return new Promise((resolve, reject) => {
if (!this._indexes) {
Function forbidden
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
helpers.forbidden = function (message, code, entity) {
if (message instanceof Error) {
var error = message;
Function get
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get (url, query, options) {
return new Promise((resolve, reject) => {
var timer = this._createTimer('get');
Function exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (logger) {
return function (error, req, res, next) {
if (error) {
Function find
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
find (filters, fields) {
var timer = this._createTimer(this.entity + ':find');
timer.data = {filters: filters, fields};