sentilo/sentilo

View on GitHub
sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js

Summary

Maintainability
F
1 wk
Test Coverage

File universal_map.js has 929 lines of code (exceeds 250 allowed). Consider refactoring.
Open


var sensorsLastObsMap = [];
var defaultChartObsLimit = 10;
var maxChartObsLimit = 200;
var componentDetailUrl;
Severity: Major
Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 2 days to fix

    Function showDataHistoryListAccordion has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function showDataHistoryListAccordion(dataPanel, sensor, componentId, sensorId, dataType) {
    
        var sensor = sensorsLastObsMap[sensorId];
    
        tempSensorLastObsMap = {

      Function toggleFullScreen has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      function toggleFullScreen(elem) {
          if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || 
              (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || 
              (document.mozFullScreen !== undefined && !document.mozFullScreen) || 
              (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {

      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 updateSensorsTabs has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      function updateSensorsTabs(data) {
      
          $("#sensors-list-tabs").hide();
          $("#sensors-list-tabs").find(".sensorItem").remove();
          $("#sensors-list-tabs").empty();

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

      function showNumericDataChart(dataPanel, componentId, sensor, filters) {
      
          getLastSensorObservations(componentId, sensor.sensor, filters, function (data) {
              var chartAnchor = $('<div id="num-chart" class="ct-chart ct-perfect-fourth ct-chart-centered-labels"></div>');
              dataPanel.html(chartAnchor);

        Function showBooleanDataChart has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function showBooleanDataChart(dataPanel, sensor, componentId, sensorId, filters) {
        
            getLastSensorObservations(componentId, sensorId, filters, function (data) {
                var chartAnchor = $('<div id="bool-chart" class="ct-chart ct-perfect-fourth ct-chart-centered-labels"></div>');
                dataPanel.html(chartAnchor);

          Function showAndLoadAudioPlayerUM has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function showAndLoadAudioPlayerUM(panel, observation) {
          
              var link = observation.value;
              var s3Link = observation.formattedValue;
              var timestamp = observation.timestamp;

            Function updateModalLayer has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function updateModalLayer(componentId) {
            
                if (currentComponentId === componentId && isModalLayerVisible()) {
                    return;
                }

              Function updateSensorsTabs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function updateSensorsTabs(data) {
              
                  $("#sensors-list-tabs").hide();
                  $("#sensors-list-tabs").find(".sensorItem").remove();
                  $("#sensors-list-tabs").empty();

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

                function showJsonUM(panel, observation) {
                
                    var json = observation.value;
                    var timestamp = observation.timestamp;
                
                

                  Consider simplifying this complex logical expression.
                  Open

                      if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || 
                          (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || 
                          (document.mozFullScreen !== undefined && !document.mozFullScreen) || 
                          (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {
                          if (elem.requestFullScreen) {
                  Severity: Critical
                  Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 1 hr to fix

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

                    function toggleFullScreen(elem) {
                        if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || 
                            (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || 
                            (document.mozFullScreen !== undefined && !document.mozFullScreen) || 
                            (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {

                      Function addAccordionGroup has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function addAccordionGroup(accordion, accordionId, dataType, header, idx, dataWrapperPrefix) {
                      Severity: Minor
                      Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 45 mins to fix

                        Function showBooleanDataChart has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function showBooleanDataChart(dataPanel, sensor, componentId, sensorId, filters) {
                        Severity: Minor
                        Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 35 mins to fix

                          Function showDataHistoryList has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function showDataHistoryList(dataPanel, sensor, componentId, sensorId, dataType) {
                          Severity: Minor
                          Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 35 mins to fix

                            Function showDataHistoryListAccordion has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function showDataHistoryListAccordion(dataPanel, sensor, componentId, sensorId, dataType) {
                            Severity: Minor
                            Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 35 mins to fix

                              Function calculateFilters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function calculateFilters(sensor, filters) {
                                  if (filters === undefined || filters === null) {
                                      filters = {
                                          limit: defaultChartObsLimit
                                      };
                              Severity: Minor
                              Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 35 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 showLastObservations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function showLastObservations(componentId, sensorId, panel) {
                              
                                  var sensor = sensorsLastObsMap[sensorId];
                              
                                  if (!sensor || sensor === null || sensor === undefined) {
                              Severity: Minor
                              Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.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

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

                              function showLastOrders(componentId, sensorId, panel) {
                              
                                  $(panel).empty();
                              
                                  getLastSensorOrders(componentId, sensorId, null, function (data) {
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 443..468

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

                              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

                              function showLastAlarms(componentId, sensorId, panel) {
                              
                                  $(panel).empty();
                              
                                  getLastSensorAlarms(componentId, sensorId, null, function (data) {
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 479..502

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

                              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

                                  var img = $('<img id="link-image" />').attr('src', s3Link)
                                      .on('load', function () {
                                          if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
                                              img.attr('src', getErrorImage());
                                              $("#image-wrapper").html(img);
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/media_players.js on lines 269..279

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

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

                              function getComponentLastAlarms(componentId, from, to, callback) {
                              
                                  var url = mapOptions.componentDetailsUrl + componentId + '/lastOb/';
                              
                                  var filters = {};
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 241..258
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 279..296

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

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

                              function getComponentLastOrders(componentId, from, to, callback) {
                              
                                  var url = mapOptions.componentDetailsUrl + componentId + '/lastOb/';
                              
                                  var filters = {};
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 241..258
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 260..277

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

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

                              function getComponentLastObservations(componentId, from, to, callback) {
                              
                                  var url = mapOptions.componentDetailsUrl + componentId + '/lastOb/';
                              
                                  var filters = {};
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 260..277
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 279..296

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

                              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

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

                                      var chartControls =
                                          '<hr/>' +
                                          '<div class="chart-controls row-fluid">' +
                                          '    <div class="chart-controls span3">' +
                                          '        <div class="btn-group">' +
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 595..607

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

                              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

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

                                      var chartControls =
                                          '<hr/>' +
                                          '<div class="chart-controls row-fluid">' +
                                          '    <div class="chart-controls span3">' +
                                          '        <div class="btn-group">' +
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 526..538

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

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

                                  wavesurfer.on('interaction', function () {
                                      $("#ellapsed-time").html(wavesurfer.getCurrentTime().toFixed(3) + 's / ' + wavesurfer.getDuration().toFixed(3) + 's');
                                  });
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/media_players.js on lines 83..85
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/media_players.js on lines 87..89
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 951..953

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

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

                                  wavesurfer.on('audioprocess', function () {
                                      $("#ellapsed-time").html(wavesurfer.getCurrentTime().toFixed(3) + 's / ' + wavesurfer.getDuration().toFixed(3) + 's');
                                  });
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/media_players.js on lines 83..85
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/media_players.js on lines 87..89
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 955..957

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

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

                              function getLastSensorObservations(componentId, sensorId, filters, callback) {
                                  var url = mapOptions.sensorLastObsUrl + componentId + '.' + sensorId + '/';
                                  jsonGET(url, filters, function (data) {
                                      callback(data);
                                  });
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 658..663
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 665..670

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

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

                              function getLastSensorOrders(componentId, sensorId, filters, callback) {
                                  var url = mapOptions.sensorLastOrdersUrl + componentId + '.' + sensorId + '/';
                                  jsonGET(url, filters, function (data) {
                                      callback(data);
                                  });
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 651..656
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 658..663

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

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

                              function getLastSensorAlarms(componentId, sensorId, filters, callback) {
                                  var url = mapOptions.sensorLastAlarmsUrl + componentId + '.' + sensorId + '/';
                                  jsonGET(url, filters, function (data) {
                                      callback(data);
                                  });
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 651..656
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 665..670

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

                              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

                                      '<div id="file-downloader-wrapper">' +
                                      '     <div id="file-details">' +
                                      filenameMessage + '&nbsp;<span id="file-filename">' + filename + '</span>&nbsp;&nbsp;&nbsp;' +
                                      timestampMessage + '&nbsp;<span id="file-timestamp">' + timestamp + '</span>' +
                                      '     </div>' +
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 997..1004

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

                              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

                                      '<div id="video-player-wrapper">' +
                                      '     <div id="video-details">' +
                                      filenameMessage + '&nbsp;<span id="video-filename">' + filename + '</span>&nbsp;&nbsp;&nbsp;' +
                                      timestampMessage + '&nbsp;<span id="video-timestamp">' + timestamp + '</span>' +
                                      '     </div>' +
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 1099..1105

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

                              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 (options.infoboxTargetId === null || options.infoboxTargetId === undefined || options.infoboxTargetId === '') {
                                      mapOptions.infoboxTargetId = "#infobox";
                                  }
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 36..38

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

                              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 (options.modalTargetId === null || options.modalTargetId === undefined || options.modalTargetId !== '') {
                                      mapOptions.modalTargetId = "#component-detail-modal-info-window";
                                  }
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 40..42

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

                              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

                              function addAlarmLineToHistoryPanel(value, timestamp) {
                                  var line =
                                      '<div class="activity_text_element">' +
                                      '    <span class="label label-info">' + timestamp + '</span>&nbsp;' +
                                      '    <span class="text">' + value + '</span>' +
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 504..511

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

                              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

                              function addOrderLineToHistoryPanel(value, timestamp) {
                                  var line =
                                      '<div class="activity_text_element">' +
                                      '    <span class="label label-info">' + timestamp + '</span>&nbsp;' +
                                      '    <span class="text">' + value + '</span>' +
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 470..477

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

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

                                          } else if (dataType === 'IMAGE_LINK') {
                                              addAccordionGroup(accordion, accordionId, dataType, header, e, imageWrapperIdPrefix);
                                              tempSensorLastObsMap.image.push({
                                                  value: value,
                                                  formattedValue: formattedValue,
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 743..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 750..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 764..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 771..778

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

                                          } else if (dataType === 'FILE_LINK') {
                                              addAccordionGroup(accordion, accordionId, dataType, header, e, fileWrapperIdPrefix);
                                              tempSensorLastObsMap.file.push({
                                                  value: value,
                                                  formattedValue: formattedValue,
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 743..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 750..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 757..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 771..778

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

                                          } else if (dataType === 'VIDEO_LINK') {
                                              addAccordionGroup(accordion, accordionId, dataType, header, e, videoWrapperIdPrefix);
                                              tempSensorLastObsMap.video.push({
                                                  value: value,
                                                  formattedValue: formattedValue,
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 743..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 757..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 764..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 771..778

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

                                          if (dataType === 'AUDIO_LINK') {
                                              addAccordionGroup(accordion, accordionId, dataType, header, e, audioWrapperIdPrefix);
                                              tempSensorLastObsMap.audio.push({
                                                  value: value,
                                                  formattedValue: formattedValue,
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 750..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 757..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 764..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 771..778

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

                                          } else if (dataType === 'JSON') {
                                              addAccordionGroup(accordion, accordionId, dataType, header, e, jsonWrapperIdPrefix);
                                              tempSensorLastObsMap.json.push({
                                                  value: value,
                                                  formattedValue: formattedValue,
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 743..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 750..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 757..778
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js on lines 764..778

                              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

                                              value = eval(sensor.value) ? messages.boolValues.trueValue.toUpperCase() : messages.boolValues.falseValue.toUpperCase();
                              sentilo-catalog-web/src/main/webapp/static/js/sentilo/component_detail.js on lines 275..275

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

                              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