konsultaner/jsonOdm

View on GitHub

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;
Severity: Critical
Found in src/geo.js - About 1 hr to fix

    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; ) {
    Severity: Minor
    Found in src/query.js - About 1 hr to fix

    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",
    Severity: Minor
    Found in src/util.js - About 1 hr to fix

      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;
      Severity: Minor
      Found in src/query.js - About 1 hr to fix

        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: "",
        Severity: Minor
        Found in karma.conf.js - About 1 hr to fix

          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;
          Severity: Minor
          Found in src/collection.js - About 1 hr to fix

            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;
            Severity: Minor
            Found in src/geo.js - About 1 hr to fix

              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++) {
              Severity: Minor
              Found in src/geo.js - About 1 hr to fix

              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]],
              Severity: Minor
              Found in src/geo.js - About 1 hr to fix

              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])) {
              Severity: Minor
              Found in src/geo.js - About 1 hr to fix

              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 = {};
                  /**
              Severity: Minor
              Found in src/odm.js - About 1 hr to fix

              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;
                  }
              
              
              Severity: Minor
              Found in src/geo.js - About 1 hr to fix

                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: "",
                Severity: Minor
                Found in karma.conf.min.js - About 1 hr to fix

                  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 &&
                  Severity: Major
                  Found in src/geo.js - About 1 hr to fix

                    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++) {
                    Severity: Minor
                    Found in src/util.js - About 55 mins to fix

                    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++) {
                    Severity: Minor
                    Found in src/geo.js - About 55 mins to fix

                    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;
                                                    }
                    Severity: Major
                    Found in src/collection.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (!inside) {
                                              break;
                                          }
                      Severity: Major
                      Found in src/geo.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (foreignKeyValue == childCollection[j][privateKeyField]) {
                                                        foreignModel = childCollection[j];
                                                        break;
                                                    }
                        Severity: Major
                        Found in src/collection.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (foreignModel != null) {
                                                          if (!collection[c][alias]) {
                                                              collection[c][alias] = [];
                                                          }
                                                          collection[c][alias].push(foreignModel);
                          Severity: Major
                          Found in src/collection.js - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language