Showing 12 of 56 total issues
File cartoDBServiceV2.ts
has 352 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 275 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 61 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 getAdm2
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAdm2(iso: string, id1: string, id2: string, period: string = defaultDate()): Promise<Record<string, any> | void> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
const gid: Record<string, any> = routeToGid(iso, id1, id2);
const simplify: number = getSimplify(iso) / 100;
const periods: string[] = period.split(',');
Function getAdm1
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAdm1(iso: string, id1: string, period: string = defaultDate()): Promise<Record<string, any> | void> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
const gid: Record<string, any> = routeToGid(iso, id1);
const simplify: number = getSimplify(iso) / 10;
const periods: string[] = period.split(',');
Function getUse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getUse(useTable: string, id: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any> | void> {
logger.debug('Obtaining use with id %s', id);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
useTable,
Function getAdm0
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAdm0(iso: string, period: string = defaultDate()): Promise<Record<string, any> | void> {
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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getWdpa(wdpaid: string, period: string = defaultDate(), apiKey: string): Promise<Record<string, any> | void> {
logger.debug('Obtaining wpda of id %s', wdpaid);
const periods: string[] = period.split(',');
const params: Record<string, any> = {
wdpaid,
Function use
has 29 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 getAdm2
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getAdm2(iso: string, id1: string, id2: string, period: string = defaultDate()): Promise<Record<string, any> | void> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
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 getAdm0
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getAdm0(iso: string, period: string = defaultDate()): Promise<Record<string, any> | void> {
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 getAdm1
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getAdm1(iso: string, id1: string, period: string = defaultDate()): Promise<Record<string, any> | void> {
logger.debug('Obtaining subnational of iso %s and id1', iso, id1);
const gid: Record<string, any> = routeToGid(iso, id1);
const simplify: number = getSimplify(iso) / 10;
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"