axsh/wakame-vdc

View on GitHub
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js

Summary

Maintainability
F
1 wk
Test Coverage

Function volumePanel has 434 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DcmgrGUI.prototype.volumePanel = function(){
  var total = 0;
  var maxrow = 10;
  var page = 1;
  var list_request = { 
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js - About 2 days to fix

File volume_panel.js has 436 lines of code (exceeds 250 allowed). Consider refactoring.
Open

DcmgrGUI.prototype.volumePanel = function(){
  var total = 0;
  var maxrow = 10;
  var page = 1;
  var list_request = { 
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js - About 6 hrs to fix

Function volumePanel has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

DcmgrGUI.prototype.volumePanel = function(){
  var total = 0;
  var maxrow = 10;
  var page = 1;
  var list_request = { 
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function changeButtonState has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  actions.changeButtonState = function() {
    var ids = c_list.currentMultiChecked()['ids'];
    var is_available = false;
    var is_attached = false;
    var is_deleting = false;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js - About 1 hr to fix

Function callback has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    callback: function(){
      var self = this;
      var loading_image = DcmgrGUI.Util.getLoadingImage('boxes');
      $(this).find('#select_storage_node').empty().html(loading_image);
      
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js - About 1 hr to fix

Function select has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    select: function(event){
      var select_action = $(this).val()
      if (select_action == "attach_volume") {
        var is_attached = false;
        var flag = true;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js - About 1 hr to fix

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

  c_list.element.bind('dcmgrGUI.contentChange',function(event,params){
    var volume = params.data.volume;
    c_pagenate.changeTotal(volume.total);
    c_list.setData(volume.results);
    c_list.multiCheckList(c_list.detail_template);
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 55..104

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

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

  bt_refresh.element.bind('dcmgrGUI.refresh',function(){
    c_list.page = c_pagenate.current_page;
    list_request.url = DcmgrGUI.Util.getPagePath('/volumes/list/',c_list.page);
    list_request.data = DcmgrGUI.Util.getPagenateData(c_pagenate.start,c_pagenate.row);
    c_list.element.trigger('dcmgrGUI.updateList',{request:list_request})
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 203..215
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/host_node_panel.js on lines 59..72
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/network_panel.js on lines 239..252
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/storage_node_panel.js on lines 61..74

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

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

  c_list.filter.add(function(data){
    var results = data.volume.results;
    var size = results.length;
    for(var i = 0; i < size; i++) {
      results[i].result.created_at = DcmgrGUI.date.parseISO8601(results[i].result.created_at);
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 106..115
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/network_panel.js on lines 226..235

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

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

          for (var i=0; i < size ; i++) {
            var uuid = results[i].result.uuid;
            var html = '<option value="'+ uuid +'">'+uuid+'</option>';
            select_storage_node.append(html);
          }
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/image_panel.js on lines 299..303

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

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 ready = function(data) {
        if(data['display_name'] == true &&
           data['volume_size'] == true) {
          bt_create_volume.disabledButton(1, false);
        } else {
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/network_panel.js on lines 321..328

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

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

  bt_create_backup.target.bind('click',function(){
    if(!bt_create_backup.is_disabled()) { 
      bt_create_backup.open(c_list.getCheckedInstanceIds());
      bt_create_backup.disabledButton(1, true);
    }
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 190..195

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

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

  c_pagenate.element.bind('dcmgrGUI.updatePagenate',function(){
    c_list.clearCheckedList();
    $('#detail').html('');
    bt_refresh.element.trigger('dcmgrGUI.refresh');
  });
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 217..221
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/host_node_panel.js on lines 74..78
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/image_panel.js on lines 135..139
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/load_balancer_panel.js on lines 745..749
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/security_group_panel.js on lines 165..169
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/sshkeypair_panel.js on lines 111..115
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/storage_node_panel.js on lines 76..80

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

    request.del({
      "url": '/volumes',
      "data": data,
      success: function(json,status){
        bt_delete_volume.disableDialogButton();
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 169..176

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

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

  var bt_detach_volume = new DcmgrGUI.Dialog({
    target:'.detach_volume',
    width:400,
    height:200,
    title:$.i18n.prop('detach_volume_header'),
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 181..188
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/image_panel.js on lines 436..443
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 508..515
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 523..530
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 589..596
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 604..611
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/load_balancer_panel.js on lines 306..313
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/load_balancer_panel.js on lines 569..576
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/load_balancer_panel.js on lines 593..600
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/security_group_panel.js on lines 223..230
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/sshkeypair_panel.js on lines 203..210
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 223..230

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

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

  var bt_delete_volume = new DcmgrGUI.Dialog({
    target:'.delete_volume',
    width:400,
    height:250,
    title:$.i18n.prop('delete_volume_header'),
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 181..188
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/image_panel.js on lines 436..443
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 508..515
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 523..530
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 589..596
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/instance_panel.js on lines 604..611
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/load_balancer_panel.js on lines 306..313
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/load_balancer_panel.js on lines 569..576
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/load_balancer_panel.js on lines 593..600
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/security_group_panel.js on lines 223..230
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/sshkeypair_panel.js on lines 203..210
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 333..340

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

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

      if(is_available == true && is_attached == true) {
        bt_delete_volume.enableDialogButton();
        bt_create_backup.enableDialogButton();
        selectmenu.data('selectmenu').disableButton();
      }
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 461..465
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 467..471
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 473..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 57.

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

      if(is_available == true && is_attached == false) {
        bt_delete_volume.enableDialogButton();
        bt_create_backup.enableDialogButton();
        selectmenu.data('selectmenu').enableButton();
      }
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 455..459
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 461..465
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 473..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 57.

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

      if (is_available == false && is_attached == false) {
        bt_delete_volume.disableDialogButton();
        bt_create_backup.disableDialogButton();
        selectmenu.data('selectmenu').disableButton();
      }
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 455..459
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 461..465
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 467..471

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

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

      if(is_available == false && is_attached == true) {
        bt_delete_volume.disableDialogButton();
        bt_create_backup.disableDialogButton();
        selectmenu.data('selectmenu').enableButton();
      }
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 455..459
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 467..471
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js on lines 473..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 57.

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

  bt_delete_volume.target.bind('click',function(){
    if(!bt_delete_volume.is_disabled()) {
      bt_delete_volume.open(c_list.getCheckedInstanceIds());
    }
  });
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 197..201

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

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

  DcmgrGUI.List.prototype.getEmptyData = function(){
    return [{
      "uuid":'',
      "size":'',
      "backup_object_id":'',
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/host_node_panel.js on lines 11..19

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

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 if(state == 'attached') {
        is_attached = true;
      } else if(state == 'deleting') {
        is_deleting = true;
      } else{
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/volume_panel.js and 1 other location - About 40 mins to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/backup_panel.js on lines 233..239

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

There are no issues that match your filters.

Category
Status