Showing 364 of 761 total issues
Function checkPathOnRequest
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
app.checkPathOnRequest = function(ctrl) {
const req = ctrl.req;
const gt = req.app.utility.gettext;
const adminResource = 0 === ctrl.path.indexOf('/rest/admin/') || 0 === ctrl.path.indexOf('/api/admin/');
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function(services, app) {
var service = new services.get(app);
const gt = app.utility.gettext;
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function(services, app) {
var service = new services.list(app);
/**
Function getInfos
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.getInfos = function(req, res) {
let gt = req.app.utility.gettext;
- 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 pagedFindPlugin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = exports = function pagedFindPlugin (schema) {
schema.statics.pagedFind = function(options, cb) {
var thisSchema = this;
if (!options.filters) {
- 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 getUserRequests
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getUserRequests(user, from, to, types) {
let calendar;
- 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 createRandomAbsence
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
api.createRandomAbsence = function(app, user, dtstart, dtend, nbdays, timeCreated) {
function createOnRight(rightDocument) {
return rightDocument.getPeriodRenewal(dtstart, dtend)
- 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 saveUser
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function saveUser(service, params) {
const gt = service.app.utility.gettext;
let User = service.app.db.models.User;
- 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 testRequired
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function testRequired(wrParams, workperiodRecoveryByApprover)
{
if (undefined === wrParams.quantity || wrParams.quantity <= 0) {
throw new Error('The quantity parameter must be positive number');
}
- 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 controllerAction
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.controllerAction = function() {
getInvitation(controller, controller.req.params.emailToken)
.then(document => {
let invitation = document.toObject();
Function getSavingPeriod
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
rightRenewalSchema.methods.getSavingPeriod = function(right) {
if (undefined === right || null === right) {
if (undefined !== this.populated('right')) {
right = this.right;
Function saveAccount
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
userSchema.methods.saveAccount = function(accountProperties) {
let userDocument = this;
return new Promise((resolve, reject) => {
Function saveAdmin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
userSchema.methods.saveAdmin = function(adminProperties) {
let userDocument = this;
return new Promise((resolve, reject) => {
Function saveManager
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
userSchema.methods.saveManager = function(managerProperties) {
let userDocument = this;
return new Promise((resolve, reject) => {
Function exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function(app) {
let config = app.config;
return function(req, res, next) {
Function populate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
api.populate = function(app, department, nbUsers, password) {
const Charlatan = require('charlatan');
let userApi = require('./User.api');
Function useLocalStrategy
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function useLocalStrategy(username, password, done) {
let conditions = {
isActive: true,
email: username
Function setRenewal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setRenewal(renewalDocument, stat) {
let renewalObj = renewalDocument.toObject();
renewalObj.initial_quantity = stat.initial;
renewalObj.consumed_quantity = stat.consumed;
Function exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function(services, app) {
let service = new services.list(app);
const gt = app.utility.gettext;
Function getManagedDepartments
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
managerSchema.methods.getManagedDepartments = function() {
var deferred = {};
deferred.promise = new Promise(function(resolve, reject) {
deferred.resolve = resolve;