Showing 364 of 761 total issues
Function createElement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function createElement(service, user, elem, collection, setElemProperties)
{
if (undefined === elem.right) {
throw new Error('element must contain a right property');
- 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 isDbNameValid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
isDbNameValid: function isDbNameValid(app, dbName, callback) {
if (!dbName.match(/[a-z0-9]+/gi) || dbName.length <= 2 || dbName.length > 100)
{
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function(services, app) {
let service = new services.list(app);
const gt = 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
Avoid too many return
statements within this function. Open
return elem.getLength();
Avoid too many return
statements within this function. Open
return Promise.reject('Unexpected consumption type '+right.consumption);
Avoid too many return
statements within this function. Open
return 'has-warning';
Avoid too many return
statements within this function. Open
return 'has-success';
Avoid too many return
statements within this function. Open
return {
created: 'accepted',
deleted: null
};
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return service.error(gt.gettext('either departments or collections must contain items'));
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return Promise.reject(new Error('Wrong parameter type for user or account'));
Avoid too many return
statements within this function. Open
return true;
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function(params) {
var mongoose = params.mongoose;
var beneficiarySchema = new params.mongoose.Schema({
- 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 saveUserRoles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function saveUserRoles(service, params, userDocument) {
const gt = service.app.utility.gettext;
if (!userDocument) {
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getConsumedQuantityBetween(user, types, periods, quantityUnit, renewal, cap) {
/**
* test if element match at least one period in list
* @return {boolean}
- 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 getStrategy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function getStrategy(config) {
if (undefined === config.company || null === config.company || undefined === config.company.calendar || undefined === config.company.calendar.google) {
throw new Error('Wrong company configuration');
}
- 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"