Showing 49 of 59 total issues
Function getRenderer
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
getRenderer (mapConfig, format, options, callback) {
if (mapConfig.isVectorOnlyMapConfig() && format !== PgMvtFactory.MVT_FORMAT) {
const error = new Error(`Unsupported format: 'cartocss' option is missing for ${format}`);
error.http_status = 400;
error.type = 'tile';
Function _update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_update: function () {
var bounds = this._map.getPixelBounds(),
zoom = this._map.getZoom(),
tileSize = this.options.tileSize;
Function fetchLayerAttributes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function fetchLayerAttributes (psql, layer) {
try {
const attrs = checkLayerAttributes(layer);
const layerSql = SubstitutionTokens.replaceXYZ(layer.options.sql, { x: 0, y: 0, z: 0 });
Function constructor
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (options) {
this._mapnikOptions = Object.assign({}, {
geometry_field: 'the_geom_webmercator',
// Metatile is the number of tiles-per-side that are going
Function getImage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
getImage (options, callback) {
const { mapConfigProvider, format, width, height, zoom, center, bbox } = options;
this._rendererCache.getRenderer(mapConfigProvider, (err, renderer) => {
if (err) {
Function ajax
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
L.Util.ajax = function (url, timeout, success, error) {
if (window.XMLHttpRequest === undefined) {
error(new Error("XMLHttpRequest is not supported"));
}
Function _loadTileP
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_loadTileP: function (zoom, x, y) {
var head = document.getElementsByTagName('head')[0],
key = zoom + '_' + x + '_' + y,
functionName = 'lu_' + key,
wk = this._windowKey,
Function getTilesFromImage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTilesFromImage (image, x, y, imageBuffer, tileSize) {
const tiles = [];
const imageWidth = image.width();
const imageHeight = image.height();
Function getStats
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getStats () {
const stats = new Map();
const rendererCacheEntries = Object.entries(this.renderers);
stats.set('rendercache.count', rendererCacheEntries.length);
Function _validateRemaningFormatLayers
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_validateRemaningFormatLayers (mapConfigProvider, mapConfig, params) {
const token = mapConfig.id();
const validateRemainingFormatLayerPromises = [];
mapConfig.getLayers().forEach((layer, layerId) => {
Function validateLayer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function validateLayer (mapConfig, layerIndex) {
const layer = mapConfig.getLayer(layerIndex);
const layerOptions = layer.options;
if (!mapConfig.isVectorOnlyMapConfig()) {
- 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 getTilesFromImage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getTilesFromImage (image, x, y, imageBuffer, tileSize) {
const tiles = [];
const imageWidth = image.width();
const imageHeight = image.height();
- 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 attrsFromCartoCSS
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function attrsFromCartoCSS (cartocss, required) {
const attrsKeys = {
'-torque-frame-count': 'steps',
'-torque-resolution': 'resolution',
'-torque-animation-duration': 'animationDuration',
- 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 values
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function values (value, allValues) {
allValues = allValues || [];
if (value.is === 'value' || value.is === 'expression') {
if (Array.isArray(value.value)) {
- 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 mapConfigToMMLBuilderConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function mapConfigToMMLBuilderConfig (mapConfig, rendererOptions, mapnikOptions) {
const options = {
ids: [],
sql: [],
originalSql: [],
- 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 getTilesFromImage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getTilesFromImage (image, x, y, imageBuffer, tileSize) {
Function getSQL
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getSQL (attributes, pg, layer, params, testMode) {
Function getTimes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getTimes () {
const times = {};
for (const [label, stat] of Object.entries(this.times)) {
if (stat.start && stat.end) {
- 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 colorRenderer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function colorRenderer (color, options, callback) {
let mapnikColor;
try {
if (Array.isArray(color)) {
- 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 getRenderer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getRenderer (mapConfig, format, options, callback) {
const isMvt = format === FORMAT_MVT;
if (mapConfig.isVectorOnlyMapConfig() && !isMvt) {
const error = new Error(`Unsupported format: 'cartocss' option is missing for ${format}`);
- 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"