Showing 56 of 100 total issues
File cartoRenderer.js
has 933 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Canvas = require('canvas');
var carto = require("carto");
var UTFGrid = require('./utfgrid');
var fs = require('fs');
var path = require('path');
Function LineString
has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring. Open
'LineString': function(text, l) {
// we support line and point, point is default
if (text.placement === "line") {
this.textAlign = "left";
- 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 cartoImageRenderer
has 253 lines of code (exceeds 25 allowed). Consider refactoring. Open
var cartoImageRenderer = function (ctx, scale, layers, styles, zoom, minX, maxX, minY) {
// background first
styles.forEach(function(style) {
if (cartoSelectorIsMatch(style, null, null, zoom)) {
style.rules.forEach(function(rule) {
Function renderInstance
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
var renderInstance = function(instanceName) {
var instanceStyle = collapsedStyle[instanceName];
ctx.save();
Function LineString
has 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
'LineString': function(text, l) {
// we support line and point, point is default
if (text.placement === "line") {
this.textAlign = "left";
Function cartoGridRenderer
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
var cartoGridRenderer = function (ctx, scale, layers, styles, zoom) {
var intColor = 1; // color zero is black/empty; so start with 1
colorIndex = ['']; // make room for black/empty
layers.forEach(function(layer, i) {
Function cartoSelectorIsMatch
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
var cartoSelectorIsMatch = function(definition, feature, source, zoom) {
// ZOOM
var supportedZooms = definition.zoom;
// 8388607 is all zooms
if (supportedZooms && supportedZooms !== 8388607) {
- 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 processStyles
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.processStyles = function(styles, assetsPath) {
var processed = [];
var imageCache = {};
styles.forEach(function(cartoString, index) {
Function _shapeBounds
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
_shapeBounds: function(shape) {
shape = shape.geometry || shape;
var coordinates = shape.coordinates;
if (shape.type === "Point") {
- 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 _shapeBounds
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
_shapeBounds: function(shape) {
shape = shape.geometry || shape;
var coordinates = shape.coordinates;
if (shape.type === "Point") {
- 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 renderAttachment
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
var renderAttachment = function(attachmentName) {
var attachmentStyle = collapsedStyle[attachmentName];
ctx.save();
File renderer.js
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Canvas = require('canvas');
var UTFGrid = require('./utfgrid');
var fs = require('fs');
var path = require('path');
var __ = require('lodash');
Function deepEqual
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
var deepEqual = function(a, b) {
try {
var aKeys = Object.keys(a),
bKeys = Object.keys(b);
}
- 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 _shapeBounds
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_shapeBounds: function(shape) {
shape = shape.geometry || shape;
var coordinates = shape.coordinates;
if (shape.type === "Point") {
Function _shapeBounds
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_shapeBounds: function(shape) {
shape = shape.geometry || shape;
var coordinates = shape.coordinates;
if (shape.type === "Point") {
Function selectorIsMatch
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
var selectorIsMatch = function(selector, feature, source) {
var matches = true;
for (var key in selector) {
if (key === "source") {
matches = matches && selector[key] === source;
- 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 imageRenderer
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
var imageRenderer = function (ctx, scale, layers, styles) {
// background first
styles.forEach(function(style) {
if (selectorIsMatch(style.selector)) {
if (style.properties["background-color"]) {
Function _shapes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_shapes: function(feature) {
var shapes = [];
if (feature.type === "FeatureCollection") {
for (var i = feature.features.length - 1; i >= 0; i--) {
shapes = shapes.concat(this._shapes(feature.features[i]));
- 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 _shapes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_shapes: function(feature) {
var shapes = [];
if (feature.type === "FeatureCollection") {
for (var i = feature.features.length - 1; i >= 0; i--) {
shapes = shapes.concat(this._shapes(feature.features[i]));
- 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 cartoImageRenderer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
var cartoImageRenderer = function (ctx, scale, layers, styles, zoom, minX, maxX, minY) {
// background first
styles.forEach(function(style) {
if (cartoSelectorIsMatch(style, null, null, zoom)) {
style.rules.forEach(function(rule) {
- 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"