Showing 12 of 22 total issues
File general.js
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
import config from '../../config'
import bluebird from 'bluebird'
import PostgresHelper from './postgres'
import * as data_access from '../../utils/data_access'
import fs from 'fs'
Function getProperties
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getProperties = (queryString) => {
return new Promise((resolve, reject) => {
let queryParts = queryString.split('_')
let key = queryParts[0]
let path = ''
Function getProperties
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export const getProperties = (queryString) => {
return new Promise((resolve, reject) => {
let queryParts = queryString.split('_')
let key = queryParts[0]
let path = ''
- 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 getUserInfo
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const getUserInfo = (token) => {
return new Promise((resolve, reject) => {
console.log('Check if user has been seen')
if (user_seen(token)) {
console.log('No need to hit Auth0')
- 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 verifyToken
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const verifyToken = (req, authOrSecDef, token, callback) => {
let errorObject = {message: 'Access Denied. Please check your token'}
if (token && token.indexOf(tokenPrefix) !== -1) {
let accessToken = token.substring(
Function buildWhere
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildWhere(params) {
let group_by = null;
if (params.group_by) {
group_by = params.group_by;
delete params.group_by
Function mergePropertiesWithShapefile
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mergePropertiesWithShapefile = (shapefileSet) => {
return new Promise((resolve, reject) => {
let {
kind,
source: dir,
Function getUserInfo
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getUserInfo = (token) => {
return new Promise((resolve, reject) => {
console.log('Check if user has been seen')
if (user_seen(token)) {
console.log('No need to hit Auth0')
Function getProperties
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getProperties(request, response) {
// key was request._key before
// key is type of data user is querying
// ex: mobility, population...
let key = request.swagger.apiPath.split('/')[2]
Function buildWhere
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
buildWhere(params) {
let group_by = null;
if (params.group_by) {
group_by = params.group_by;
delete params.group_by
- 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 value_map
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
let value_map = shapefile.reduce((ary, element) => {
let tempList = Object.keys(element).filter(key => {
return (key.startsWith('id_'))
}).map(key => {
return element[key]
Function countries_with_this_kind_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const countries_with_this_kind_data = (kind, source, country) => {
return new Promise((resolve, reject) => {
// Get country name for each shapefile
getShapeFiles(kind, source)
.then(shapefileSet => {
- 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"