Showing 22 of 69 total issues
File cartoDBServiceV2.ts
has 407 lines of code (exceeds 250 allowed). Consider refactoring. Open
import config from 'config';
import logger from 'logger';
import Mustache from 'mustache';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
File cartoDBService.ts
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
import config from 'config';
import logger from 'logger';
import Mustache from 'mustache';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Function init
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
const init: () => Promise<IInit> = async (): Promise<IInit> => {
return new Promise((resolve: (value: IInit | PromiseLike<IInit>) => void
) => {
const app: Koa = new Koa();
Function getUse
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getUse(useTable: string, id: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining use with id %s', id);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
useTable,
Function getAdm0
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAdm0(iso: string, alertQuery: string, period: string = defaultDate()): Promise<Record<string, any>> {
logger.debug('Obtaining national of iso %s', iso);
const gid: Record<string, any> = routeToGid(iso);
const simplify: number = getSimplify(iso);
const periods: string[] = period.split(',');
Function getWdpa
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getWdpa(wdpaid: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining wpda of id %s', wdpaid);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
wdpaid,
Function getAdm2
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAdm2(iso: string, id1: string, id2: string, alertQuery: string, period: string = defaultDate()): Promise<Record<string, any>> {
logger.debug('Obtaining regional data', iso, id1, id2);
const gid: Record<string, any> = routeToGid(iso, id1, id2);
const simplify: number = getSimplify(iso) / 100;
const periods: string[] = period.split(',');
Function getAdm1
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAdm1(iso: string, id1: string, alertQuery: string, period: string = defaultDate()): Promise<Record<string, any>> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
const gid: Record<string, any> = routeToGid(iso, id1);
const simplify: number = getSimplify(iso) / 100;
const periods: string[] = period.split(',');
Function getAdm0
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async getAdm0(iso: string, alertQuery: string, period: string = defaultDate()): Promise<Record<string, any>> {
logger.debug('Obtaining national of iso %s', iso);
const gid: Record<string, any> = routeToGid(iso);
const simplify: number = getSimplify(iso);
const periods: string[] = period.split(',');
- 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 getSubnational
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getSubnational(iso: string, id1: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
iso,
Function getNational
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getNational(iso: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining national of iso %s', iso);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
iso,
Function use
has 30 lines of code (exceeds 25 allowed). Consider refactoring. 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;
switch (ctx.params.name) {
Function getUse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getUse(useName: string, useTable: string, id: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining use with id %s', id);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
useTable,
Function getWdpa
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getWdpa(wdpaid: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining wpda of id %s', wdpaid);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
wdpaid,
Function getWdpa
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async getWdpa(wdpaid: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining wpda of id %s', wdpaid);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
wdpaid,
- 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 getUse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async getUse(useTable: string, id: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining use with id %s', id);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
useTable,
- 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 getAdm2
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getAdm2(iso: string, id1: string, id2: string, alertQuery: string, period: string = defaultDate()): Promise<Record<string, any>> {
logger.debug('Obtaining regional data', iso, id1, id2);
const gid: Record<string, any> = routeToGid(iso, id1, id2);
const simplify: number = getSimplify(iso) / 100;
const periods: string[] = period.split(',');
- 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 getAdm1
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getAdm1(iso: string, id1: string, alertQuery: string, period: string = defaultDate()): Promise<Record<string, any>> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
const gid: Record<string, any> = routeToGid(iso, id1);
const simplify: number = getSimplify(iso) / 100;
const periods: string[] = period.split(',');
- 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 getNational
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async getNational(iso: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining national of iso %s', iso);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
iso,
- 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 getSubnational
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async getSubnational(iso: string, id1: string, alertQuery: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any>> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
iso,
- 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"