Showing 31 of 41 total issues
Function obtainFSFromAST
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
static obtainFSFromAST(parsed) {
logger.info('Generating FeatureService object from ast object');
let fs = {};
if (parsed.select && parsed.select.length > 0) {
- 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 converterService.js
has 408 lines of code (exceeds 250 allowed). Consider refactoring. Open
const logger = require('logger');
const SQLService = require('services/sqlService');
const { geojsonToArcGIS } = require('arcgis-to-geojson-utils');
const { arcgisToGeoJSON } = require('arcgis-to-geojson-utils');
const Sql2json = require('sql2json').sql2json;
Function sql2SQL
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async sql2SQL(data, apiKey, isRaster = false, experimental = false) {
logger.debug('Converting sql to sql', data);
const parsed = new Sql2json(data.sql, experimental).toJSON();
if (!parsed) {
return SQLService.generateError('Malformed query');
Function obtainFSFromAST
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
static obtainFSFromAST(parsed) {
logger.info('Generating FeatureService object from ast object');
let fs = {};
if (parsed.select && parsed.select.length > 0) {
Function obtainSelect
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
static obtainSelect(fs) {
let result = '';
if (!fs.outFields && !fs.outStatistics) {
return '*';
}
- 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 findIntersect
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
static findIntersect(node, found, result) {
if (node && node.type === 'string' && node.value && found) {
try {
const geojson = JSON.parse(node.value);
if (!result) {
- 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 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (grunt) => {
grunt.file.setBase('..');
// eslint-disable-next-line import/no-extraneous-dependencies
require('load-grunt-tasks')(grunt);
Function obtainWhere
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
static async obtainWhere(params, apiKey) {
const fs = params;
let where = '';
if (fs.where) {
if (!where) {
- 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 sql2SQL
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static async sql2SQL(data, apiKey, isRaster = false, experimental = false) {
logger.debug('Converting sql to sql', data);
const parsed = new Sql2json(data.sql, experimental).toJSON();
if (!parsed) {
return SQLService.generateError('Malformed query');
- 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 init
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function init() {
return new Promise((resolve) => {
const app = new Koa();
Function exports
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (() => {
const loadAPI = (app, path, pathApi) => {
const routesFiles = fs.readdirSync(path);
let existIndexRouter = false;
Function obtainWhere
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async obtainWhere(params, apiKey) {
const fs = params;
let where = '';
if (fs.where) {
if (!where) {
Function findIntersect
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
static findIntersect(node, found, result) {
if (node && node.type === 'string' && node.value && found) {
try {
const geojson = JSON.parse(node.value);
if (!result) {
Function loadAPI
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const loadAPI = (app, path, pathApi) => {
const routesFiles = fs.readdirSync(path);
let existIndexRouter = false;
routesFiles.forEach((file) => {
const newPath = path ? (`${path}/${file}`) : file;
Function obtainSelect
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static obtainSelect(fs) {
let result = '';
if (!fs.outFields && !fs.outStatistics) {
return '*';
}
Function sql2FS
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async sql2FS(params, apiKey) {
const sql = params.sql.trim();
logger.info('Creating featureservice from sql', sql);
const parsed = new Sql2json(sql).toJSON();
if (!parsed) {
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (() => {
const loadAPI = (app, path, pathApi) => {
const routesFiles = fs.readdirSync(path);
let existIndexRouter = false;
- 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 deeply nested control flow statements. Open
if (node.alias) {
obj.outStatisticFieldName = node.alias;
}
Avoid deeply nested control flow statements. Open
if (outFields !== '') {
outFields += ',';
}
Avoid deeply nested control flow statements. Open
for (let j = 0, { length: argumentsLength } = node.arguments; j < argumentsLength; j++) {
const argument = node.arguments[j];
if (outFields !== '') {
outFields += ',';
}