linguisticexplorer/Linguistic-Explorer

View on GitHub
public/javascripts/gmaps4rails/gmaps4rails.base.js

Summary

Maintainability
F
1 wk
Test Coverage

Function Gmaps4Rails has 475 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  this.Gmaps4Rails = (function() {

    function Gmaps4Rails() {
      this.map = null;
      this.serviceObject = null;
Severity: Major
Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 2 days to fix

    File gmaps4rails.base.js has 500 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function() {
      var Gmaps;
    
      Gmaps = {};
    
    
    Severity: Minor
    Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 day to fix

      Function Gmaps4Rails has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function Gmaps4Rails() {
            this.map = null;
            this.serviceObject = null;
            this.visibleInfoWindow = null;
            this.userLocation = null;
      Severity: Major
      Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 2 hrs to fix

        Function adjustMapToBounds has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Gmaps4Rails.prototype.adjustMapToBounds = function() {
              var bound, circle, map_center, point, polygon, polygon_points, polyline, polyline_points, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _n, _ref, _ref2, _ref3, _ref4;
              if (this.map_options.auto_adjust || this.map_options.bounds !== null) {
                this.boundsObject = this.createLatLngBounds();
              }
        Severity: Minor
        Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                if ((circle.lat != null) && (circle.lng != null)) {
                  newCircle = new google.maps.Circle({
                    center: this.createLatLng(circle.lat, circle.lng),
                    strokeColor: circle.strokeColor || this.circles_conf.strokeColor,
                    strokeOpacity: circle.strokeOpacity || this.circles_conf.strokeOpacity,
          Severity: Critical
          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

            Function create_polyline has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                Gmaps4Rails.prototype.create_polyline = function(polyline) {
                  var clickable, decoded_array, element, latlng, new_poly, point, polyline_coordinates, strokeColor, strokeOpacity, strokeWeight, zIndex, _i, _j, _len, _len2;
                  polyline_coordinates = [];
                  for (_i = 0, _len = polyline.length; _i < _len; _i++) {
                    element = polyline[_i];
            Severity: Minor
            Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

              Function createServiceMarkersFromMarkers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Gmaps4Rails.prototype.createServiceMarkersFromMarkers = function() {
                    var Lat, LatLng, Lng, index, marker, _len, _ref;
                    _ref = this.markers;
                    for (index = 0, _len = _ref.length; index < _len; index++) {
                      marker = _ref[index];
              Severity: Minor
              Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

                Function create_circle has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    Gmaps4Rails.prototype.create_circle = function(circle) {
                      var newCircle;
                      if (circle === this.circles[0]) {
                        if (circle.strokeColor != null) {
                          this.circles_conf.strokeColor = circle.strokeColor;
                Severity: Minor
                Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

                  Function create_direction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      Gmaps4Rails.prototype.create_direction = function() {
                        var directionsDisplay, directionsService, request;
                        directionsDisplay = new google.maps.DirectionsRenderer();
                        directionsService = new google.maps.DirectionsService();
                        directionsDisplay.setMap(this.serviceObject);
                  Severity: Minor
                  Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

                    Function create_polygon has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Gmaps4Rails.prototype.create_polygon = function(polygon) {
                          var clickable, fillColor, fillOpacity, latlng, new_poly, point, polygon_coordinates, strokeColor, strokeOpacity, strokeWeight, _i, _len;
                          polygon_coordinates = [];
                          for (_i = 0, _len = polygon.length; _i < _len; _i++) {
                            point = polygon[_i];
                    Severity: Minor
                    Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (point === polygon[0]) {
                                strokeColor = point.strokeColor || this.polygons_conf.strokeColor;
                                strokeOpacity = point.strokeOpacity || this.polygons_conf.strokeOpacity;
                                strokeWeight = point.strokeWeight || this.polygons_conf.strokeWeight;
                                fillColor = point.fillColor || this.polygons_conf.fillColor;
                      Severity: Major
                      Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                  if (element === polyline[0]) {
                                    strokeColor = element.strokeColor || this.polylines_conf.strokeColor;
                                    strokeOpacity = element.strokeOpacity || this.polylines_conf.strokeOpacity;
                                    strokeWeight = element.strokeWeight || this.polylines_conf.strokeWeight;
                                    clickable = element.clickable || this.polylines_conf.clickable;
                        Severity: Major
                        Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 40 mins to fix

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

                                  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                                    polyline = _ref[_i];
                                    polyline_points = polyline.serviceObject.latLngs.getArray()[0].getArray();
                                    for (_j = 0, _len2 = polyline_points.length; _j < _len2; _j++) {
                                      point = polyline_points[_j];
                          Severity: Major
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js and 1 other location - About 4 hrs to fix
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 454..461

                          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 134.

                          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

                                  for (_k = 0, _len3 = _ref2.length; _k < _len3; _k++) {
                                    polygon = _ref2[_k];
                                    polygon_points = polygon.serviceObject.latLngs.getArray()[0].getArray();
                                    for (_l = 0, _len4 = polygon_points.length; _l < _len4; _l++) {
                                      point = polygon_points[_l];
                          Severity: Major
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js and 1 other location - About 4 hrs to fix
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 445..452

                          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 134.

                          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 11 locations. Consider refactoring.
                          Open

                              Gmaps4Rails.prototype.create_circles = function() {
                                var circle, _i, _len, _ref, _results;
                                _ref = this.circles;
                                _results = [];
                                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                          Severity: Major
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js and 10 other locations - About 4 hrs to fix
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 191..200
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 206..215
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 236..245
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 293..302
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 89..98
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 104..113
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 121..130
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 176..185
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 187..196
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 198..207

                          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 121.

                          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 11 locations. Consider refactoring.
                          Open

                              Gmaps4Rails.prototype.hide_circles = function() {
                                var circle, _i, _len, _ref, _results;
                                _ref = this.circles;
                                _results = [];
                                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                          Severity: Major
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js and 10 other locations - About 4 hrs to fix
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 144..153
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 191..200
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 236..245
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 293..302
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 89..98
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 104..113
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 121..130
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 176..185
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 187..196
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 198..207

                          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 121.

                          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 11 locations. Consider refactoring.
                          Open

                              Gmaps4Rails.prototype.create_polygons = function() {
                                var polygon, _i, _len, _ref, _results;
                                _ref = this.polygons;
                                _results = [];
                                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                          Severity: Major
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js and 10 other locations - About 4 hrs to fix
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 144..153
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 191..200
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 206..215
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 293..302
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 89..98
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 104..113
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 121..130
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 176..185
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 187..196
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 198..207

                          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 121.

                          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 11 locations. Consider refactoring.
                          Open

                              Gmaps4Rails.prototype.create_polylines = function() {
                                var polyline, _i, _len, _ref, _results;
                                _ref = this.polylines;
                                _results = [];
                                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                          Severity: Major
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js and 10 other locations - About 4 hrs to fix
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 144..153
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 191..200
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 206..215
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 236..245
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 89..98
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 104..113
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 121..130
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 176..185
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 187..196
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 198..207

                          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 121.

                          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 11 locations. Consider refactoring.
                          Open

                              Gmaps4Rails.prototype.clear_circles = function() {
                                var circle, _i, _len, _ref, _results;
                                _ref = this.circles;
                                _results = [];
                                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                          Severity: Major
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js and 10 other locations - About 4 hrs to fix
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 144..153
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 206..215
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 236..245
                          public/javascripts/gmaps4rails/gmaps4rails.base.js on lines 293..302
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 89..98
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 104..113
                          public/javascripts/gmaps4rails/gmaps4rails.bing.js on lines 121..130
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 176..185
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 187..196
                          public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js on lines 198..207

                          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 121.

                          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

                          There are no issues that match your filters.

                          Category
                          Status