NLeSC/Cesium-NcWMS

View on GitHub
app/scripts/ncwmsservice/ncwms.service.js

Summary

Maintainability
F
4 days
Test Coverage

Function NcwmsService has 273 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function NcwmsService($q, $http, Messagebus) {
    this.ncWMSURL = 'http://localhost:8080/ncWMS-2.0-rc1-maartenvm/wms?';

    var deferred = $q.defer();
    this.ready = deferred.promise;
Severity: Major
Found in app/scripts/ncwmsservice/ncwms.service.js - About 1 day to fix

    Function getFeatureInfoSeries has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.getFeatureInfoSeries = function(selectedDataset, selectedPalette, boundingRect, callbackSuccess, callbackFailure) {
          if (this.datasets.length === 0) {
            return;
          }
    
    
    Severity: Major
    Found in app/scripts/ncwmsservice/ncwms.service.js - About 3 hrs to fix

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

          this.init = function() {
            // load JSON data
            $http.get('serverconfig.json').then(function(res) {
              if (res.data.id === 'ncWMS') {
                this.ncWMSURL = res.data.url;
      Severity: Major
      Found in app/scripts/ncwmsservice/ncwms.service.js - About 3 hrs to fix

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

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

                  this.getFeatureInfoSeries = function(selectedDataset, selectedPalette, boundingRect, callbackSuccess, callbackFailure) {
              Severity: Minor
              Found in app/scripts/ncwmsservice/ncwms.service.js - About 35 mins 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

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

                            } else {
                              Messagebus.publish('graphMinChange', this.datasets[0].min);
                              Messagebus.publish('graphMaxChange', this.datasets[0].max);
                            }
                Severity: Minor
                Found in app/scripts/ncwmsservice/ncwms.service.js and 1 other location - About 50 mins to fix
                app/scripts/ncwmsservice/ncwms.service.js on lines 130..133

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

                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 (this.datasets[0].graphicalMin !== 0) {
                              Messagebus.publish('graphMinChange', this.datasets[0].graphicalMin);
                              Messagebus.publish('graphMaxChange', this.datasets[0].graphicalMax);
                            } else {
                Severity: Minor
                Found in app/scripts/ncwmsservice/ncwms.service.js and 1 other location - About 50 mins to fix
                app/scripts/ncwmsservice/ncwms.service.js on lines 133..136

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

                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