NLeSC/Cesium-NcWMS

View on GitHub
app/scripts/customgraph/customgraph.controller.js

Summary

Maintainability
F
1 wk
Test Coverage

Function CustomGraphController has 374 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function CustomGraphController($scope, $window, $timeout, $http, d3Service, NcwmsService, Messagebus, UserAgent) {
    this.mobile = UserAgent.mobile;
    
    this.selectedLabel = '';
    this.selectedUnits = '';
Severity: Major
Found in app/scripts/customgraph/customgraph.controller.js - About 1 day to fix

    Function init has 299 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.init = function(element, attrs) {
          this.dragging = false;
    
          var container = element.children[0].children[1];
          var hoverContainer, hoverLine, hoverLineXOffset, hoverLineYOffset, hoverLineGroup,
    Severity: Major
    Found in app/scripts/customgraph/customgraph.controller.js - About 1 day to fix

      Function render has 259 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              this.render = function(data) {
                // remove all previous items before render
                d3.select(container).selectAll('*').remove();
      
                if (!this.activated) {
      Severity: Major
      Found in app/scripts/customgraph/customgraph.controller.js - About 1 day to fix

        File customgraph.controller.js has 380 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        (function() {
          'use strict';
          /*
            source: D3 example @ http://bl.ocks.org/rkirsling/33a9e350516da54a5d4f
          */
        Severity: Minor
        Found in app/scripts/customgraph/customgraph.controller.js - About 5 hrs to fix

          Function drawPaths has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      this.drawPaths = function(svg, data, x, y, chartWidth, chartHeight) {
                        var pathContainer = svg.append('g');
          
                        var upperOuterArea = d3.svg.area()
                          .interpolate('basis')
          Severity: Major
          Found in app/scripts/customgraph/customgraph.controller.js - About 3 hrs to fix

            Function makeChart has 85 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        this.makeChart = function(data) {
                          var svgWidth = width;
                          var svgHeight = width / 2;
                          var margin = {
                            top: 20,
            Severity: Major
            Found in app/scripts/customgraph/customgraph.controller.js - About 3 hrs to fix

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

                          this.addAxesAndLegend = function(svg, xAxis, yAxis, margin, chartWidth, chartHeight) {
                            var legendWidth = 0,
                              legendHeight = 0;
              
                            svg.append('clipPath')
              Severity: Minor
              Found in app/scripts/customgraph/customgraph.controller.js - About 1 hr to fix

                Function CustomGraphController has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  function CustomGraphController($scope, $window, $timeout, $http, d3Service, NcwmsService, Messagebus, UserAgent) {
                Severity: Major
                Found in app/scripts/customgraph/customgraph.controller.js - About 1 hr to fix

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

                              this.addAxesAndLegend = function(svg, xAxis, yAxis, margin, chartWidth, chartHeight) {
                  Severity: Minor
                  Found in app/scripts/customgraph/customgraph.controller.js - About 45 mins to fix

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

                                this.drawPaths = function(svg, data, x, y, chartWidth, chartHeight) {
                    Severity: Minor
                    Found in app/scripts/customgraph/customgraph.controller.js - About 45 mins to fix

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

                                    var lowerOuterArea = d3.svg.area()
                                      .interpolate('basis')
                                      .x(function(d) {
                                        return x(d.date) || 1;
                                      })
                      Severity: Major
                      Found in app/scripts/customgraph/customgraph.controller.js and 3 other locations - About 3 hrs to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 208..216
                      app/scripts/customgraph/customgraph.controller.js on lines 218..228
                      app/scripts/customgraph/customgraph.controller.js on lines 239..249

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

                      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

                                    var upperOuterArea = d3.svg.area()
                                      .interpolate('basis')
                                      .x(function(d) {
                                        return x(d.date) || 1;
                                      }).y0(function(d) {
                      Severity: Major
                      Found in app/scripts/customgraph/customgraph.controller.js and 3 other locations - About 3 hrs to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 218..228
                      app/scripts/customgraph/customgraph.controller.js on lines 239..249
                      app/scripts/customgraph/customgraph.controller.js on lines 251..261

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

                      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

                                    var upperInnerArea = d3.svg.area()
                                      .interpolate('basis')
                                      .x(function(d) {
                                        return x(d.date) || 1;
                                      })
                      Severity: Major
                      Found in app/scripts/customgraph/customgraph.controller.js and 3 other locations - About 3 hrs to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 208..216
                      app/scripts/customgraph/customgraph.controller.js on lines 239..249
                      app/scripts/customgraph/customgraph.controller.js on lines 251..261

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

                      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

                                    var lowerInnerArea = d3.svg.area()
                                      .interpolate('basis')
                                      .x(function(d) {
                                        return x(d.date) || 1;
                                      })
                      Severity: Major
                      Found in app/scripts/customgraph/customgraph.controller.js and 3 other locations - About 3 hrs to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 208..216
                      app/scripts/customgraph/customgraph.controller.js on lines 218..228
                      app/scripts/customgraph/customgraph.controller.js on lines 251..261

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

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

                            Messagebus.subscribe('ncwmsDatasetSelected', function(event, value) {
                              if (this.globalSelectedDataset !== value) {
                                this.globalSelectedDataset = value;
                      
                                this.setSelections();
                      Severity: Major
                      Found in app/scripts/customgraph/customgraph.controller.js and 6 other locations - About 1 hr to fix
                      app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 6..11
                      app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 24..29
                      app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 32..37
                      app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 40..45
                      app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 48..53
                      app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 56..61

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

                      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 xAxis = d3.svg.axis()
                                      .scale(x)
                                      .orient('bottom')
                                      .innerTickSize(-chartHeight)
                                      .outerTickSize(0)
                      Severity: Major
                      Found in app/scripts/customgraph/customgraph.controller.js and 1 other location - About 1 hr to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 432..437

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

                      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 yAxis = d3.svg.axis()
                                      .scale(y)
                                      .orient('left')
                                      .innerTickSize(-chartWidth)
                                      .outerTickSize(0)
                      Severity: Major
                      Found in app/scripts/customgraph/customgraph.controller.js and 1 other location - About 1 hr to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 425..430

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

                      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

                                    hoverLine = hoverLineGroup
                                      .append('line')
                                      .attr('x1', 10).attr('x2', 10) // vertical line so same value on each
                                      .attr('y1', 0).attr('y2', chartHeight); // top to bottom
                      Severity: Minor
                      Found in app/scripts/customgraph/customgraph.controller.js and 1 other location - About 55 mins to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 311..314

                      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

                                    timeIndicatorLine = timeIndicatorLineGroup
                                      .append('line')
                                      .attr('x1', 10).attr('x2', 10) // vertical line so same value on each
                                      .attr('y1', 0).attr('y2', chartHeight); // top to bottom
                      Severity: Minor
                      Found in app/scripts/customgraph/customgraph.controller.js and 1 other location - About 55 mins to fix
                      app/scripts/customgraph/customgraph.controller.js on lines 298..301

                      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

                            Messagebus.subscribe('ncwmsPaletteSelected', function(event, value) {
                              if (this.selectedPalette !== value) {
                                this.selectedPalette = value;
                              }
                            }.bind(this));
                      Severity: Minor
                      Found in app/scripts/customgraph/customgraph.controller.js and 1 other location - About 55 mins to fix
                      app/scripts/dataset/dataset.controller.js on lines 12..16

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

                      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