Showing 56 of 100 total issues
Function _screenLine
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_screenLine: function(dashArray, start, end, realLength, angle, offset) {
// we're gonna do some transforms
this.save();
// move the line out by half a pixel for more crisp 1px drawing
Function cartoSelectorIsMatch
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
var cartoSelectorIsMatch = function(definition, feature, source, zoom) {
// ZOOM
var supportedZooms = definition.zoom;
// 8388607 is all zooms
if (supportedZooms && supportedZooms !== 8388607) {
Function utfGrid
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.utfGrid = function utfGrid(options){
var options = options || {},
map = options.map,
format;
Function _screenLine
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_screenLine: function(dashArray, start, end, realLength, angle, offset) {
// we're gonna do some transforms
this.save();
// move the line out by half a pixel for more crisp 1px drawing
- 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 a Cognitive Complexity of 12 (exceeds 5 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"]) {
- 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 deepEqual
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
var deepEqual = function(a, b) {
try {
var aKeys = Object.keys(a),
bKeys = Object.keys(b);
}
Function renderGrid
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var renderGrid = exports.renderGrid = function(options) {
var bounds = options.bounds;
var width = options.width;
var height = options.height;
var callback = options.callback;
Consider simplifying this complex logical expression. Open
if (selectorIsMatch(style.selector, feature, source)) {
style = style.properties;
ctx.fillStyle = style.fillStyle || style['background-color'] || '';
ctx.strokeStyle = style.strokeStyle || style['line-color'] || '';
Function renderGrid
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
var renderGrid = exports.renderGrid = function(minX, minY, maxX, maxY, width, height, layers, styles, featureImage, callback) {
Function encodeAsObject
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
encodeAsObject: function() {
var grid = {
grid: [],
keys: [""],
data: {}
- 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 gridRenderer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var gridRenderer = function (ctx, scale, layers, styles) {
var intColor = 1; // color zero is black/empty; so start with 1
colorIndex = ['']; // make room for black/empty
Function load
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: function(callback) {
if (this._data || this._loadError) {
callback(this._loadError, this._data);
return;
}
Function tilePng
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function tilePng(req, res, next){
var tileCoordinate, format, bounds;
// verify arguments (don't forget jsonp!)
tileCoordinate = req.path.match(/(\d+)\/(\d+)\/(\d+)\.(png|json|jsonp)$/);
Function renderGrid
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var renderGrid = exports.renderGrid = function(minX, minY, maxX, maxY, width, height, layers, styles, featureImage, callback) {
var canvas = new Canvas(width, width),
ctx = canvas.getContext('2d'),
// we're using the same ratio for width and height, so the actual maxY may not match specified maxY...
pxPtRatio = width / (maxX - minX),
Function renderImage
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
var renderImage = exports.renderImage = function(minX, minY, maxX, maxY, width, height, layers, styles, callback) {
Function LINE_DASH_PROPERTY
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var LINE_DASH_PROPERTY = (function() {
var canvas = new Canvas(8, 8);
var ctx = canvas.getContext("2d");
var property = (ctx.dash && "dash") || (ctx.lineDash && "lineDash");
if (!property) {
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
var cartoImageRenderer = function (ctx, scale, layers, styles, zoom, minX, maxX, minY) {
Function intersects
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var intersects = function(a, b) {
var xIntersects = (a.minX < b.maxX && a.minX > b.minX) ||
(a.maxX < b.maxX && a.maxX > b.minX) ||
(a.minX < b.minX && a.maxX > b.maxX);
- 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 intersects
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var intersects = function(a, b) {
var xIntersects = (a.minX < b.maxX && a.minX > b.minX) ||
(a.maxX < b.maxX && a.maxX > b.minX) ||
(a.minX < b.minX && a.maxX > b.maxX);
- 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 Point
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
'Point': function(inProjection, outProjection, c) {
if (inProjection && outProjection) {
var inProjectionCode = inProjection instanceof Proj4js.Proj ?
'EPSG:' + inProjection.srsProjNumber : inProjection;
var outProjectionCode = outProjection instanceof Proj4js.Proj ?
- 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"