Showing 175 of 272 total issues
Consider simplifying this complex logical expression. Open
if (
// out of bounds check
(
(point[0] >= lineString[i][0] && point[0] <= lineString[i + 1][0] && lineString[i][0] <= lineString[i + 1][0]) ||
(point[0] <= lineString[i][0] && point[0] >= lineString[i + 1][0] && lineString[i][0] >= lineString[i + 1][0])
Function intersects
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.MultiLineString.intersects = function (multiLineString, geometry) {
var i, j, k;
if (!multiLineString.coordinates || !jsonOdm.util.isArray(multiLineString.coordinates)) {
return false;
}
Function decorate
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Collection.decorate = function (collection) {
var decorate = function (collection) {
if (jsonOdm.util.isArray(collection)) {
/**
* // TODO needs a proper has many functionality that aromatically gathers the child elements
Function intersects
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.LineString.intersects = function (lineString, geometry) {
var i, j;
if (!lineString.coordinates || !jsonOdm.util.isArray(lineString.coordinates)) {
return false;
}
Function decorate
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
var decorate = function (collection) {
if (jsonOdm.util.isArray(collection)) {
/**
* // TODO needs a proper has many functionality that aromatically gathers the child elements
* Creates a has many relation to another collection
Function pointWithinLineString
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Geo.pointWithinLineString = function (point, lineString) {
if (!(jsonOdm.util.isArray(point) && jsonOdm.util.isArray(lineString) && lineString.length >= 2)) {
return false;
}
for (var i = 0; i < lineString.length - 1; 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 within
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.MultiPolygon.within = function (multiPolygon, geometry) {
var i, j, k, found;
if (!multiPolygon.coordinates || !jsonOdm.util.isArray(multiPolygon.coordinates)) {
return false;
}
Function $queryOperator
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Query.prototype.$queryOperator = function (queries, operator) {
var $testCollection = (function (queries, currentOprator) {
return function (collection) {
if (typeof currentOprator !== "function") {
return 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
Function within
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.LineString.within = function (lineString, geometry) {
var i, j;
if (!lineString.coordinates || !jsonOdm.util.isArray(lineString.coordinates)) {
return false;
}
Function intersects
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.Polygon.intersects = function (polygon, geometry) {
var i, j;
if (!polygon.coordinates || !jsonOdm.util.isArray(polygon.coordinates)) {
return false;
}
Function pointWithinPolygon
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Geo.pointWithinPolygon = function (point, polygon) {
if (!(jsonOdm.util.isArray(point) && jsonOdm.util.isArray(polygon) && polygon.length > 2)) {
return 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
Function intersects
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.MultiPolygon.intersects = function (multiPolygon, geometry) {
var i, j, k;
if (!multiPolygon.coordinates || !jsonOdm.util.isArray(multiPolygon.coordinates)) {
return false;
}
Function within
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.Point.within = function (point, geometry) {
var i, j;
if (!point.coordinates) {
return false;
}
Function within
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.Polygon.within = function (polygon, geometry) {
var i, j;
if (!polygon.coordinates || !jsonOdm.util.isArray(polygon.coordinates)) {
return false;
}
Consider simplifying this complex logical expression. Open
} else if (jsonOdm.util.isArray(geometry) && geometry.length >= 1 &&
jsonOdm.util.isArray(geometry[0]) && geometry[0].length >= 1 &&
jsonOdm.util.isArray(geometry[0][0]) && geometry[0][0].length >= 1 &&
jsonOdm.util.isArray(geometry[0][0][0]) && geometry[0][0][0].length === 2 && !jsonOdm.util.isArray(geometry[0][0][0][0])) {
geometry = new jsonOdm.Geo.MultiPolygon(geometry);
Function projectElement
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Util.prototype.projectElement = function (projection, element, parentElement) {
var projectionResult = {};
for (var key in projection) {
if (!projection.hasOwnProperty(key)) {
continue;
- 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 $testCollection
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Query.prototype.$testCollection = function (comparables, collectionTest) {
var lastCommand = this.$$commandQueue.pop();
var $testCollection = (function () {
return function (collection) {
if (!((lastCommand instanceof jsonOdm.Collection || typeof lastCommand === "function" || typeof lastCommand === "undefined") && typeof collectionTest === "function")) {
- 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 $result
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Query.prototype.$result = function (start, length) {
if (this.$$commandQueue.length < 1 && this.$$aggregationBeforeCollectQueue < 1) {
return this.$$collection;
}
start = typeof start === "undefined" ? 0 : start;
Consider simplifying this complex logical expression. Open
if (
(lineString[i][0] === point[0] && lineString[i][1] === point[1]) ||
(lineString[i + 1][0] === point[0] && lineString[i + 1][1] === point[1]) ||
((lineString[i][1] - lineString[i + 1][1]) != 0 && ((lineString[i][0] - lineString[i + 1][0]) * ((point[1] - lineString[i + 1][1]) / (lineString[i][1] - lineString[i + 1][1])) + lineString[i + 1][0] === point[0])) ||
Consider simplifying this complex logical expression. Open
if (
!(
// next is not the next one
(inLineString[j + 1] && lineString[i + 1][0] === inLineString[j + 1][0] && lineString[i + 1][1] === inLineString[j + 1][1]) ||
// next is not the same one