Showing 6 of 34 total issues
Function init
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const init: () => Promise<IInit> = async (): Promise<IInit> => {
return new Promise((resolve: (value: IInit | PromiseLike<IInit>) => void
) => {
const app: Koa = new Koa();
Function getViirsAlerts
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
static async getViirsAlerts(
apiKey: string,
alertQuery: string,
queryParams: Record<string, any>,
datasetIds: {
- 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
File datasetService.ts
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import config from 'config';
import logger from 'logger';
import Mustache from 'mustache';
import GeostoreService from 'services/geostoreService';
import { RWAPIMicroservice } from "rw-api-microservice-node";
Function getViirsAlerts
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async getViirsAlerts(
apiKey: string,
alertQuery: string,
queryParams: Record<string, any>,
datasetIds: {
Function getAdm
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async getAdm(apiKey: string, iso: string, forSubscription: string, period: string = defaultDate(), group: boolean = false, adm1: string = null, adm2: string = null): Promise<Record<string, any>> {
logger.debug('Obtaining national of iso %s and period %s', iso, period);
const periods: string[] = period.split(',');
const params: {
iso: string;
Function use
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async use(ctx: Context): Promise<void> {
logger.info('Obtaining use data with name %s and id %s', ctx.params.name, ctx.params.id);
let useTable: string = null;
switch (ctx.params.name) {
case 'mining':