biciguia/biciguia-frontend

View on GitHub

Showing 8 of 12 total issues

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

function routeButton() {
  mixpanel.track("routeButton");

  if(markers[0] != undefined && markers[1] != undefined) {
    getAndShowRoute();
Severity: Minor
Found in libs/ui_route.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 initializeMap has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function initializeMap() {
  if (document.getElementById('map') === null) return;
  map = L.map('map',{
    // TODO change
    maxBounds: coordsToLeafletBounds(maxBounds),
Severity: Minor
Found in libs/lib_map.js - About 1 hr to fix

    Function addRouteToMap has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function addRouteToMap(decodedResponse) {
      elev = L.control.elevation({
          position: "bottomleft",
          theme: "steelblue-theme", //default: lime-theme
          width: 600,
    Severity: Minor
    Found in libs/ui_route.js - About 1 hr to fix

      Function setMarker has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function setMarker(source, address, zoomIn) {
        var coords = [address.lat, address.lon];
        var zoom = 17;
        var element = $('#'+source+'-address');
        if (element.val() != address.display_name) {
      Severity: Minor
      Found in libs/ui_nominatim.js - About 1 hr to fix

        Function setMarker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function setMarker(source, address, zoomIn) {
          var coords = [address.lat, address.lon];
          var zoom = 17;
          var element = $('#'+source+'-address');
          if (element.val() != address.display_name) {
        Severity: Minor
        Found in libs/ui_nominatim.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 createBrokenRouteObject has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function createBrokenRouteObject(text, origin, destination, origin_point, destination_point, route) {
        Severity: Minor
        Found in libs/lib_route.js - About 45 mins to fix

          Function showAddressList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function showAddressList(addresses, source) {
            // if user writes something and exits the edit box, do not show the address list
            var activeElement = getSelectedAddressElement();
            if (source != activeElement) {
              spinner.stop();
          Severity: Minor
          Found in libs/ui_address.js - About 25 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 removeRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function removeRoute() {
            if (routeLine) {
              if (map.hasLayer(routeLine)) {
                map.removeLayer(routeLine);
                routeLine = undefined;
          Severity: Minor
          Found in libs/ui_route.js - About 25 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

          Severity
          Category
          Status
          Source
          Language