NLeSC/Cesium-NcWMS

View on GitHub

Showing 81 of 81 total issues

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

      img.onload = function() {
        context.canvas.width = 150;
        context.canvas.height = 10;

        context.translate(150, 0);
Severity: Major
Found in app/scripts/palette/palette.controller.js and 1 other location - About 2 hrs to fix
app/scripts/palette/palette.iamlegend.directive.js on lines 13..20

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

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

File ncwms.service.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
  'use strict';

  function NcwmsService($q, $http, Messagebus) {
    this.ncWMSURL = 'http://localhost:8080/ncWMS-2.0-rc1-maartenvm/wms?';
Severity: Minor
Found in app/scripts/ncwmsservice/ncwms.service.js - About 2 hrs to fix

    Function success has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            this.getMenu().then(function success(menuPromise) {
              // Build an array containing our datasets (--NG--)
              this.datasets = this.loadMenu(menuPromise);
              // Store the first dataset as our 'currently selected' dataset
              // (--NG--)
    Severity: Major
    Found in app/scripts/ncwmsservice/ncwms.service.js - About 2 hrs to fix

      Function BigLegendController has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function BigLegendController($scope, DecimalAdjust, Messagebus, UserAgent) {
          this.mobile = UserAgent.mobile;
      
          this.logarithmic = false;
          Messagebus.subscribe('logarithmicChange', function(event, value) {
      Severity: Major
      Found in app/scripts/biglegend/biglegend.controller.js - About 2 hrs to fix

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

                    if (child.id.indexOf('stats_group') > -1) {
                      //This is a stats group, so we will infer the min and max from the first child
                      result.push({
                        id: child.id,
                        label: dataSetLabel + '/' + child.label,
        Severity: Major
        Found in app/scripts/ncwmsservice/ncwms.service.js and 1 other location - About 2 hrs to fix
        app/scripts/ncwmsservice/ncwms.service.js on lines 190..203

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

        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 (grandChild.plottable) {
                          //The children of stats_groups are treated as normal datasets
                          result.push({
                            id: grandChild.id,
                            label: dataSetLabel + '/' + grandChild.label,
        Severity: Major
        Found in app/scripts/ncwmsservice/ncwms.service.js and 1 other location - About 2 hrs to fix
        app/scripts/ncwmsservice/ncwms.service.js on lines 161..187

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function repaintColorMap has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.repaintColorMap = function() {
              if (!NcwmsService.initialized) {
                return;
              }
        
        
        Severity: Major
        Found in app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js - About 2 hrs to fix

          Function loadMenu has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              this.loadMenu = function(menuPromiseResolve) {
                var result = [];
          
                this.ncWMSdata.metadata = menuPromiseResolve.data.children;
                menuPromiseResolve.data.children.forEach(function(dataset) {
          Severity: Major
          Found in app/scripts/ncwmsservice/ncwms.service.js - About 2 hrs to fix

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

                      colorMapLayer = CesiumViewerService.viewer.scene.imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
                        url: NcwmsService.ncWMSURL,
                        layers: this.selectedDataset.id,
                        parameters: parameters,
                        enablePickFeatures: false
            app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 134..139

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

            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

                      colorMapLayer = CesiumViewerService.viewer.scene.imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
                        url: NcwmsService.ncWMSURL,
                        layers: this.selectedDataset.id,
                        parameters: parameters,
                        enablePickFeatures: false
            app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 118..123

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                this.addPicking = function() {
                  var ellipsoid = CesiumViewerService.viewer.scene.globe.ellipsoid;
                  //var labels = new Cesium.LabelCollection();
                  //labels.add();
                  //CesiumViewerService.viewer.scene.primitives.add(labels);
            Severity: Minor
            Found in app/scripts/cesiumviewer/cesium-viewer.controller.js - About 1 hr to fix

              Function OutlinesController has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function OutlinesController($scope, $http, Cesium, CesiumViewerService, Messagebus, UserAgent) {
                  this.mobile = UserAgent.mobile;
                  this.outlines = false;
                  this.values = [];
              
              
              Severity: Minor
              Found in app/scripts/outlines/outlines.controller.js - About 1 hr to fix

                Function CesiumViewerService has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function CesiumViewerService(Cesium) {
                        return {
                            init: function(element) {      
                                this.clock = new Cesium.Clock({
                                    multiplier : 500.0
                Severity: Minor
                Found in app/scripts/cesiumviewer/cesium-viewer.service.js - About 1 hr to fix

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

                      Messagebus.subscribe('legendMaxChange', function(event, value) {
                        if (this.legendMax !== value) {
                          this.legendMax = value;
                          this.repaintColorMap();
                        }
                  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/customgraph/customgraph.controller.js on lines 73..79

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

                      Messagebus.subscribe('terrainChange', function(event, value) {
                        if (this.terrain !== value) {
                          this.terrain = value;
                          this.repaintColorMap();
                        }
                  app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 6..11
                  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
                  app/scripts/customgraph/customgraph.controller.js on lines 73..79

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

                      Messagebus.subscribe('ncwmsTimeSelected', function(event, value) {
                        if (this.selectedTime !== value) {
                          this.selectedTime = value;
                          this.repaintColorMap();
                        }
                  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
                  app/scripts/customgraph/customgraph.controller.js on lines 73..79

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

                      Messagebus.subscribe('ncwmsDatasetSelected', function(event, value) {
                        if (this.selectedDataset !== value) {
                          this.selectedDataset = value;
                          this.repaintColorMap();
                        }
                  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 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
                  app/scripts/customgraph/customgraph.controller.js on lines 73..79

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

                      Messagebus.subscribe('legendMinChange', function(event, value) {
                        if (this.legendMin !== value) {
                          this.legendMin = value;
                          this.repaintColorMap();
                        }
                  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 56..61
                  app/scripts/customgraph/customgraph.controller.js on lines 73..79

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

                      Messagebus.subscribe('ncwmsPaletteSelected', function(event, value) {
                        if (this.selectedPalette !== value) {
                          this.selectedPalette = value;
                          this.repaintColorMap();
                        }
                  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 48..53
                  app/scripts/cesiumncwmslayer/cesium.ncwms.layer.controller.js on lines 56..61
                  app/scripts/customgraph/customgraph.controller.js on lines 73..79

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language