publiclab/leaflet-blurred-location

View on GitHub

Showing 19 of 19 total issues

Function BlurredLocation has 300 lines of code (exceeds 25 allowed). Consider refactoring.
Open

BlurredLocation = function BlurredLocation(options) {

  var blurredLocation = this;
  var blurred = true;
  var DEFAULT_PRECISION = 6;
Severity: Major
Found in src/blurredLocation.js - About 1 day to fix

    Function BlurredLocation has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

    BlurredLocation = function BlurredLocation(options) {
    
      var blurredLocation = this;
      var blurred = true;
      var DEFAULT_PRECISION = 6;
    Severity: Minor
    Found in src/blurredLocation.js - About 1 day 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 Geocoding has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function Geocoding(options) {
    
      var map = options.map || document.getElementById("map") || L.map('map');
      var google = window.google || undefined;
      var geocoder = google ? new google.maps.Geocoder() : undefined;
    Severity: Major
    Found in src/core/Geocoding.js - About 5 hrs to fix

      Function Geocoding has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function Geocoding(options) {
      
        var map = options.map || document.getElementById("map") || L.map('map');
        var google = window.google || undefined;
        var geocoder = google ? new google.maps.Geocoder() : undefined;
      Severity: Minor
      Found in src/core/Geocoding.js - About 3 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 gridSystem has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function gridSystem(options) {
      
        var map = options.map || document.getElementById("map") || L.map('map');
        options.cellSize = options.cellSize || { rows:100, cols:100 };
      
      
      Severity: Minor
      Found in src/core/gridSystem.js - About 3 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 gridSystem has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function gridSystem(options) {
      
        var map = options.map || document.getElementById("map") || L.map('map');
        options.cellSize = options.cellSize || { rows:100, cols:100 };
      
      
      Severity: Major
      Found in src/core/gridSystem.js - About 3 hrs to fix

        File blurredLocation.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        BlurredLocation = function BlurredLocation(options) {
        
          var blurredLocation = this;
          var blurred = true;
          var DEFAULT_PRECISION = 6;
        Severity: Minor
        Found in src/blurredLocation.js - About 3 hrs to fix

          Function Interface has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function Interface (options) {
          
              options.latId = options.latId || 'lat';
              options.lngId = options.lngId || 'lng';
              options.placenameInputId = options.placenameInputId || 'placenameInput'; // the placename input box id
          Severity: Major
          Found in src/ui/Interface.js - About 2 hrs to fix

            Function Interface has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function Interface (options) {
            
                options.latId = options.latId || 'lat';
                options.lngId = options.lngId || 'lng';
                options.placenameInputId = options.placenameInputId || 'placenameInput'; // the placename input box id
            Severity: Minor
            Found in src/ui/Interface.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 exports has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function(grunt) {
              "use strict";
              require("matchdep")
                .filterDev("grunt-*")
                .forEach(grunt.loadNpmTasks);
            Severity: Minor
            Found in Gruntfile.js - About 1 hr to fix

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

                              getLabeledCoordinate: function(coordinate, coordinate_type, decimalPlacesAfterZero) {
                                  var dir = "";
                                  if (coordinate_type == "lat") {
                                    if (coordinate < 0) {
                                        coordinate = coordinate * -1;
              Severity: Minor
              Found in src/core/gridSystem.js - About 1 hr to fix

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

                                lngFormatTickLabel: function(lng) {
                                           var decimalPlacesAfterZero = 0;
                                           lng = lng.toString();
                                           decimalPlacesAfterZero = this.getDecimalPlacesAfterZero(); 
                                           return this.getLabeledCoordinate(lng, "lng", decimalPlacesAfterZero);
                Severity: Major
                Found in src/core/gridSystem.js and 1 other location - About 1 hr to fix
                src/core/gridSystem.js on lines 21..26

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

                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

                                 latFormatTickLabel: function(lat) {
                                            var decimalPlacesAfterZero = 0;
                                            lat = lat.toString();
                                            decimalPlacesAfterZero = this.getDecimalPlacesAfterZero();
                                            return this.getLabeledCoordinate(lat, "lat", decimalPlacesAfterZero);
                Severity: Major
                Found in src/core/gridSystem.js and 1 other location - About 1 hr to fix
                src/core/gridSystem.js on lines 28..33

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

                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 getPlacenameFromCoordinates has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function getPlacenameFromCoordinates(lat, lng, precision, onResponse) {
                    if(geocoder) {
                      geocoder.geocode( { 'location': {lat: lat, lng: lng}}, function(results, status) {
                          if(status === "OK") {
                
                
                Severity: Minor
                Found in src/core/Geocoding.js - About 1 hr to fix

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

                        $("#"+options.lngId).val(options.getLon().toFixed(Math.max(0,options.getPrecision())));
                  Severity: Minor
                  Found in src/ui/Interface.js and 1 other location - About 55 mins to fix
                  src/ui/Interface.js on lines 47..47

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

                  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

                        $("#"+options.latId).val(options.getLat().toFixed(Math.max(0,options.getPrecision())));
                  Severity: Minor
                  Found in src/ui/Interface.js and 1 other location - About 55 mins to fix
                  src/ui/Interface.js on lines 48..48

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

                  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

                  Avoid deeply nested control flow statements.
                  Open

                                if (fullAddress.length >= 3) onResponse(fullAddress[fullAddress.length - 3] + "," + fullAddress[fullAddress.length - 2] + "," + country);
                                else if (fullAddress.length == 2) onResponse(fullAddress[fullAddress.length - 2] + "," + country);
                                else onResponse(country);
                  Severity: Major
                  Found in src/core/Geocoding.js - About 45 mins to fix

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

                                  if (fullAddress.length>=2) onResponse(fullAddress[fullAddress.length - 2] + "," + country);
                                  else onResponse(country);
                    Severity: Minor
                    Found in src/core/Geocoding.js and 1 other location - About 35 mins to fix
                    src/core/Geocoding.js on lines 31..32

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

                    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

                                  else if (fullAddress.length == 2) onResponse(fullAddress[fullAddress.length - 2] + "," + country);
                                  else onResponse(country);
                    Severity: Minor
                    Found in src/core/Geocoding.js and 1 other location - About 35 mins to fix
                    src/core/Geocoding.js on lines 25..26

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

                    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