konsultaner/jsonOdm

View on GitHub

Showing 272 of 272 total issues

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;
    }
Severity: Major
Found in src/geo.js - About 2 hrs to fix

    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
    Severity: Major
    Found in src/collection.js - About 2 hrs to fix

      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;
          }
      Severity: Major
      Found in src/geo.js - About 2 hrs to fix

        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
        Severity: Major
        Found in src/collection.js - About 2 hrs to fix

          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++) {
          Severity: Minor
          Found in src/geo.js - About 2 hrs 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 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;
              }
          Severity: Major
          Found in src/geo.js - About 2 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            jsonOdm.Query.prototype.$min = function (branch) {
                return this.$accumulator(branch, function (value, accumulation) {
                    if (accumulation === false) {
                        accumulation = value;
                    }
            Severity: Major
            Found in src/query.js and 1 other location - About 2 hrs to fix
            src/query.js on lines 525..532

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            jsonOdm.Query.prototype.$max = function (branch) {
                return this.$accumulator(branch, function (value, accumulation) {
                    if (accumulation === false) {
                        accumulation = value;
                    }
            Severity: Major
            Found in src/query.js and 1 other location - About 2 hrs to fix
            src/query.js on lines 545..552

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

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

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

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

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

                        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;
                        Severity: Minor
                        Found in src/util.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

                        Similar blocks of code found in 7 locations. Consider refactoring.
                        Open

                        jsonOdm.Geo.MultiLineString = function (positions, boundaryBox) {
                            this.type = "MultiLineString";
                            this.coordinates = positions;
                            if (boundaryBox) {
                                this.bbox = boundaryBox;
                        Severity: Major
                        Found in src/geo.js and 6 other locations - About 1 hr to fix
                        src/geo.js on lines 135..141
                        src/geo.js on lines 222..228
                        src/geo.js on lines 413..419
                        src/geo.js on lines 748..754
                        src/geo.js on lines 888..894
                        src/geo.js on lines 1031..1037

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 66.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            if (!(jsonOdm.util.isArray(edge) && edge.length === 2 && jsonOdm.util.isArray(polygon) && polygon.length >= 2)) {
                                return false;
                            }
                        Severity: Major
                        Found in src/geo.js and 1 other location - About 1 hr to fix
                        src/geo.js on lines 1159..1161

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 66.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 7 locations. Consider refactoring.
                        Open

                        jsonOdm.Geo.MultiPoint = function (positions, boundaryBox) {
                            this.type = "MultiPoint";
                            this.coordinates = positions;
                            if (boundaryBox) {
                                this.bbox = boundaryBox;
                        Severity: Major
                        Found in src/geo.js and 6 other locations - About 1 hr to fix
                        src/geo.js on lines 135..141
                        src/geo.js on lines 413..419
                        src/geo.js on lines 567..573
                        src/geo.js on lines 748..754
                        src/geo.js on lines 888..894
                        src/geo.js on lines 1031..1037

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 66.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language