Showing 129 of 129 total issues
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return GeostoreService.getGeostoreFromUseId(params.use, params.useid);
Function searchImage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const searchImage = (story) => {
if (story.media) {
for (let i = 0, { length } = story.media; i < length; i++) {
if (story.media[i].previewUrl) {
return DOMAIN_IMAGE + story.media[i].previewUrl;
- 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 validateSubscription
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static validateSubscription(subs) {
if ((!subs.datasets || subs.datasets.length === 0) && (!subs.datasetsQuery || subs.datasetsQuery.length === 0)) {
return 'Datasets or datasetsQuery required';
}
if (!subs.language) {
- 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 calculateAlertFrequency
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static async calculateAlertFrequency(thisYearAlerts, lastYearAlerts, lang) {
const lastYearAverage = _.mean(lastYearAlerts.map((al) => al.alert__count));
const lastYearStdDev = EmailHelpersService.standardDeviation(lastYearAlerts.map((al) => al.alert__count));
const currentAvg = _.mean(thisYearAlerts.map((al) => al.alert__count));
- 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 checkUpdated
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static async checkUpdated(dataset) {
logger.info(`Checking if dataset ${dataset} was updated`);
try {
const result = await ctRegisterMicroservice.requestToMicroservice({
uri: `/${dataset}/latest`,
- 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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static async execute(subscription, layerSlug, begin, end, forSubscription) {
logger.info('Executing analysis for', layerSlug, begin, end);
const period = `${formatDate(begin)},${formatDate(end)}`;
- 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 findAllSubscriptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static async findAllSubscriptions(ctx) {
logger.info(`[SubscriptionsRouter] Getting ALL subscriptions`);
const page = ctx.query.page && ctx.query.page.number ? parseInt(ctx.query.page.number, 10) : 1;
const limit = ctx.query.page && ctx.query.page.size ? parseInt(ctx.query.page.size, 10) : 10;
- 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"