publiclab/leaflet-blurred-location

View on GitHub

Showing 13 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

                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

                  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
                    Severity
                    Category
                    Status
                    Source
                    Language