Showing 364 of 761 total issues
Avoid deeply nested control flow statements. Open
if ($scope.accountScheduleCalendars[i].from) {
$scope.accountScheduleCalendars[i].from = new Date($scope.accountScheduleCalendars[i].from);
}
Avoid deeply nested control flow statements. Open
if ($scope.accountCollections[i].to) {
$scope.accountCollections[i].to = new Date($scope.accountCollections[i].to);
}
Avoid deeply nested control flow statements. Open
if ($scope.accountNWDaysCalendars[i].from) {
$scope.accountNWDaysCalendars[i].from = new Date($scope.accountNWDaysCalendars[i].from);
}
Avoid deeply nested control flow statements. Open
if (adjustedRenewals[id].adjustmentSum !== 0) {
$scope.adjustedRenewals.push(adjustedRenewals[id]);
}
Function addEvents
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function addEvents(cal, fromDate, toDate, calendarEventsResource, personalEventsResource, user)
Avoid deeply nested control flow statements. Open
if ($scope.accountNWDaysCalendars[i].to) {
$scope.accountNWDaysCalendars[i].to = new Date($scope.accountNWDaysCalendars[i].to);
}
Avoid deeply nested control flow statements. Open
if ($scope.accountCollections[i].from) {
$scope.accountCollections[i].from = new Date($scope.accountCollections[i].from);
}
Function createRandomAbsence
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
api.createRandomAbsence = function(app, user, dtstart, dtend, nbdays, timeCreated) {
Function createRandomAccountRequest
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
api.createRandomAccountRequest = function(app, collectionProps, rightProps, dtstart, dtend, nbdays) {
Function exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exports = module.exports = function(models, userDocument, account, admin, manager, callback){
Function query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var query = function(service, params, next) {
let find = service.app.db.models.User.find()
- 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 getConsumedQuantityBetween
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function getConsumedQuantityBetween(user, types, periods, quantityUnit, renewal, cap) {
Function getExpandedEra
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getExpandedEra(docs, dtstart, dtend)
{
if (!(dtstart instanceof Date) || !(dtend instanceof Date)) {
throw new Error('parameters must be dates');
- 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 createAbsenceOnRenewal
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
api.createAbsenceOnRenewal = function(app, renewal, user, dtstart, dtend, nbdays) {
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function(services, app) {
var service = new services.list(app);
- 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
Consider simplifying this complex logical expression. Open
if (!match[1] || !match[2] || !match[3] || !match[4] || !match[5] || !match[6]) {
// Require at least year mont day hour minute second
continue;
}
Function validateRule
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
rightRuleSchema.methods.validateRule = function(renewal, user, dtstart, dtend, moment) {
Function setMonthView
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setMonthView(cal, startDate, calendarEventsResource, personalEventsResource, user) {
Function createCalendar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function createCalendar(year, month, calendarEventsResource, personalEventsResource, user) {
Function validateRules
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
rightSchema.methods.validateRules = function(renewal, user, dtstart, dtend, timeCreated) {