Showing 175 of 272 total issues
Consider simplifying this complex logical expression. Open
if (
(bounds1[0] > bounds2[0] && bounds1[0] > bounds2[2]) || (bounds1[1] > bounds2[1] && bounds1[1] > bounds2[3]) ||
(bounds2[0] > bounds1[0] && bounds2[0] > bounds1[2]) || (bounds2[1] > bounds1[1] && bounds2[1] > bounds1[3])
) {
return false;
Function $delete
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Query.prototype.$delete = function () {
if (this.$$commandQueue.length < 1) {
return this;
}
for (var i = 0; i < this.$$collection.length; ) {
- 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 objectKeysPolyfill
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Util.prototype.objectKeysPolyfill = (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = [
"toString",
Function $text
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Query.prototype.$text = function (text) {
var notRegExp = /(^| )-([^ ]+)( |$)/g;
var andRegExp = /"([^"]+)"/g;
var nots = [], ands = [];
var notMatches, andMatches;
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",
Function $hasMany
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
collection.$hasMany = function (foreignKeyMapName, privateKeyField, childCollectionName, alias) {
// SET THE ALIAS
if (typeof childCollectionName === "string") alias = alias || childCollectionName;
// FIND THE CHILD COLLECTION
var childCollection = childCollectionName;
Function lineStringWithinLineString
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.lineStringWithinLineString = function (lineString, inLineString) {
if (!(jsonOdm.util.isArray(lineString) && jsonOdm.util.isArray(inLineString))) {
return false;
}
var i, j;
Function within
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Geo.GeometryCollection.within = function (geometryCollection, geometry) {
if (!jsonOdm.util.isArray(geometryCollection.geometries) || !geometryCollection.geometries.length || !geometry.type) {
return false;
}
for (var i = 0; i < geometryCollection.geometries.length; 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 edgeIntersectsEdge
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Geo.edgeIntersectsEdge = function (edge1, edge2, allowOnEdge) {
allowOnEdge = typeof allowOnEdge === "undefined" ? true : allowOnEdge;
var directionVector1 = [edge1[1][0] - edge1[0][0], edge1[1][1] - edge1[0][1]],
bounds1 = [Math.min(edge1[0][0], edge1[1][0]), Math.min(edge1[0][1], edge1[1][1]), Math.max(edge1[0][0], edge1[1][0]), Math.max(edge1[0][1], edge1[1][1])],
directionVector2 = [edge2[1][0] - edge2[0][0], edge2[1][1] - edge2[0][1]],
- 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 detectAsGeometry
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Geo.detectAsGeometry = function (geometry) {
if (!geometry.type) {
if (jsonOdm.util.isArray(geometry) && geometry.length === 2 && !jsonOdm.util.isArray(geometry[0])) {
geometry = new jsonOdm.Geo.Point(geometry);
} else if (jsonOdm.util.isArray(geometry) && geometry.length === 4 && !jsonOdm.util.isArray(geometry[0])) {
- 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 JsonOdm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function JsonOdm() {
var self = this;
this.sources = {};
this.selectedSource = {};
/**
- 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 pointWithinPolygon
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonOdm.Geo.pointWithinPolygon = function (point, polygon) {
if (!(jsonOdm.util.isArray(point) && jsonOdm.util.isArray(polygon) && polygon.length > 2)) {
return false;
}
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",
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 === 2 && !jsonOdm.util.isArray(geometry[0][0][0])) {
geometry = new jsonOdm.Geo.Polygon(geometry);
} else if (jsonOdm.util.isArray(geometry) && geometry.length >= 1 &&
Function is
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Util.prototype.is = function (object, type) {
type = (typeof type === "string") ? [type] : type;
var objectType = Object.prototype.toString.call(object);
objectType = objectType.substring(8, objectType.length - 1).toLowerCase();
for (var i = 0; i < type.length; 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 intersects
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
jsonOdm.Geo.GeometryCollection.intersects = function (geometryCollection, geometry) {
if (!jsonOdm.util.isArray(geometryCollection.geometries) || !geometryCollection.geometries.length || !geometry.type) {
return false;
}
for (var i = 0; i < geometryCollection.geometries.length; 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
Avoid deeply nested control flow statements. Open
for (var j = 0; j < childCollection.length; j++) {
if (foreignKeyMap[i] == childCollection[j][privateKeyField]) {
foreignModel = childCollection[j];
break;
}
Avoid deeply nested control flow statements. Open
if (!inside) {
break;
}
Avoid deeply nested control flow statements. Open
if (foreignKeyValue == childCollection[j][privateKeyField]) {
foreignModel = childCollection[j];
break;
}
Avoid deeply nested control flow statements. Open
if (foreignModel != null) {
if (!collection[c][alias]) {
collection[c][alias] = [];
}
collection[c][alias].push(foreignModel);