axsh/wakame-vdc

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

Summary

Maintainability
F
2 wks
Test Coverage

File core.js has 1225 lines of code (exceeds 250 allowed). Consider refactoring.
Open

window.DcmgrGUI = function(){};

//Refarence:http://wp.serpere.info/archives/1091
DcmgrGUI.Class = (function() {
  function subclass() {}
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 3 days to fix

Function MONITOR_ITEMS has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DcmgrGUI.VifMonitorSelector.MONITOR_ITEMS = (function(){
  return {
    'PING': {
      title: 'Ping',
      ui: function (elem, params){
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 6 hrs to fix

Function MONITOR_ITEMS has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

DcmgrGUI.VifMonitorSelector.MONITOR_ITEMS = (function(){
  return {
    'PING': {
      title: 'Ping',
      ui: function (elem, params){
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 3 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 addItem has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addItem: function(item_key, json){
    var self = this;
    var idx = this._newIndex();

    var find_unselected_item_key = function(){
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 2 hrs to fix

Function initialize has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initialize: function(params){
    DcmgrGUI.ContentBase.prototype.initialize(params);
    this.checked_list = {};
    this.detail_template = {};
    this.maxrow = params.maxrow;
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 2 hrs to fix

Function addItem has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  addItem: function(item_key, json){
    var self = this;
    var idx = this._newIndex();

    var find_unselected_item_key = function(){
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 1 hr 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 multiCheckList has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  multiCheckList:function(params){
    var self = this;
    var checkboxies = this.element.find("[type='checkbox']");
    checkboxies.each(function(key,value){
      
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 1 hr to fix

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

  initialize: function(params) {
    var self = this;
    this.element = $('#pagenate');
    this.view = $("#viewPagenate").text();
    this.total = params.total;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 1 hr to fix

Function checkTextField has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DcmgrGUI.Util.checkTextField = function(e) {
    var d = e.data;
    var name = d.name;
    var is_ready = d.is_ready;
    var ready = d.ready;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 1 hr to fix

Function singleCheckList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  singleCheckList:function(params){
    var self = this;
    this.element.find("[type='radio']").each(function(key,value){
      $(this).click(function(){
        var check_id = $(this).val();
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 1 hr to fix

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

  updatePage: function(event){
    var self = event.data.obj;
    if($(this).attr('class')) {
      var name = $(this).attr('class').split(' ')[0];
    }
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 35 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

  queryParams: function(){
    var res="";

    for (var i=0; i < this.item_list.length; i++) {
      var itm = this.item_list[i];
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 35 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

  getLog: function(limit, type) {
    var size = this.stack.length;
    var results = [];
    var count = 0;
    var limit = limit || this.stack.length;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 35 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  initialize: function(params) {
    this.element = $(params.target);
    this.left_select_id = params.left_select_id;
    this.right_select_id = params.right_select_id;
    this.data = params.data;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 25 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function apply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  apply: function(index,data){
    if (this.filters[index] && typeof this.filters[index] === "function") {
      this.filters[index](data);
      var next_index = index + 1;
      if (this.filters[next_index]) {
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 25 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  publish: function(topic_id) {
    if(this.topics[topic_id]) {
      var size = this.topics[topic_id].length;
      for (i=0; i < size; i++) {
        var topic = this.topics[topic_id][i];
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js - About 25 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    'HTTP1': {
      title: 'HTTP',
      ui: function (elem, params){
        if(params === undefined) params={port: 80, check_path:"/"};

Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 1 day to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1236..1252

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

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

    'HTTPS1': {
      title: 'HTTPS',
      ui: function (elem, params){
        if(params === undefined) params={port: 443, check_path:"/"};

Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 1 day to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1219..1235

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

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

    'SMTP': {
      title: 'SMTP',
      ui: function (elem, params){
        if(params === undefined) params={port: 25};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1253..1265
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1266..1278
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1292..1304
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1305..1317
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1318..1330
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1346..1358
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1359..1371

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

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

    'POSTGRESQL': {
      title: 'PostgreSQL',
      ui: function (elem, params){
        if(params === undefined) params={port: 5432};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1253..1265
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1266..1278
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1279..1291
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1292..1304
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1305..1317
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1318..1330
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1346..1358

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

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

    'SUBMISSION': {
      title: 'Submission',
      ui: function (elem, params){
        if(params === undefined) params={port: 587};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1253..1265
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1266..1278
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1279..1291
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1292..1304
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1305..1317
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1346..1358
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1359..1371

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

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

    'FTP': {
      title: 'FTP',
      ui: function (elem, params){
        if(params === undefined) params={port: 21};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1266..1278
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1279..1291
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1292..1304
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1305..1317
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1318..1330
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1346..1358
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1359..1371

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

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

    'SSH': {
      title: 'SSH',
      ui: function (elem, params){
        if(params === undefined) params={port: 22};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1253..1265
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1279..1291
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1292..1304
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1305..1317
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1318..1330
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1346..1358
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1359..1371

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

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

    'IMAP': {
      title: 'IMAP',
      ui: function (elem, params){
        if(params === undefined) params={port: 143};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1253..1265
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1266..1278
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1279..1291
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1292..1304
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1318..1330
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1346..1358
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1359..1371

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

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

    'POP3': {
      title: 'POP3',
      ui: function (elem, params){
        if(params === undefined) params={port: 110};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1253..1265
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1266..1278
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1279..1291
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1305..1317
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1318..1330
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1346..1358
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1359..1371

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

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

    'MYSQL': {
      title: 'MySQL',
      ui: function (elem, params){
        if(params === undefined) params={port: 3306};
        elem.append('Port: <input type="text" class="_tcp_port" width="4" value="'+params['port']+'"></input>');
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 7 other locations - About 6 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1253..1265
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1266..1278
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1279..1291
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1292..1304
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1305..1317
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1318..1330
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 1359..1371

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

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

      if(data.item.created_at) {
        data.item.created_at = DcmgrGUI.date.parseISO8601(data.item.created_at);
        data.item.created_at = DcmgrGUI.date.setTimezone(data.item.created_at, dcmgrGUI.getConfig('time_zone'));
        data.item.created_at = DcmgrGUI.date.getI18n(data.item.created_at);
      }
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 2 other locations - About 4 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 669..673
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 675..679

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

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

      if(data.item.updated_at) {
        data.item.updated_at = DcmgrGUI.date.parseISO8601(data.item.updated_at);
        data.item.updated_at = DcmgrGUI.date.setTimezone(data.item.updated_at, dcmgrGUI.getConfig('time_zone'));
        data.item.updated_at = DcmgrGUI.date.getI18n(data.item.updated_at);
      }
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 2 other locations - About 4 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 663..667
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 675..679

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

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

      if(data.item.last_login_at) {
        data.item.last_login_at = DcmgrGUI.date.parseISO8601(data.item.last_login_at);
        data.item.last_login_at = DcmgrGUI.date.setTimezone(data.item.last_login_at, dcmgrGUI.getConfig('time_zone'));
        data.item.last_login_at = DcmgrGUI.date.getI18n(data.item.last_login_at);
      }
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 2 other locations - About 4 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 663..667
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 669..673

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

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.data[i]['selected']) {
        var html = '<option id="'+i+'" value="'+ this.data[i]['value'] +'">'+ this.data[i]['name'] +' (' + this.data[i]['id'] +')</option>';
        this.rightSelectionsArray[i] = $(html);
      }
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 3 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 913..916

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

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.data[i]['selected']) {
        var html = '<option id="'+i+'" value="'+ this.data[i]['value'] +'">'+ this.data[i]['name'] +' ('+ this.data[i]['id'] +')</option>';
        this.leftSelectionsArray[i] = $(html);
      }
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 3 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 920..923

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

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

    this.prev.bind("click",{obj: this},function(event){
      var self = event.data.obj;
      if (self.prev.button("option","disabled")) { 
        return false;
      };
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 2 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 225..233

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

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

    this.next.bind("click",{obj: this},function(event){
      var self = event.data.obj;
      if (self.next.button("option","disabled")) { 
        return false;
      };
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 2 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 215..223

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

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(self.current_page > 1 && self.current_page <= self.page_count){
      if(name === 'prev'){
        self.prev_page = self.current_page -1;
        self.current_page = self.prev_page;
      }
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 2 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 310..315

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

    if(self.current_page >= 1 && self.current_page < self.page_count) {
      if(name === 'next'){
        self.next_page = self.current_page +1;
        self.current_page = self.next_page;
      }
Severity: Major
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 2 hrs to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 317..322

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

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

        if(text) {
            is_ready[name] = true;
            ready(is_ready);
        } else {
            is_ready[name] = false;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 35 mins to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 557..563

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

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

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

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

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

Refactorings

Further Reading

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

    if(text) {
        is_ready[name] = true;
        ready(is_ready);
    } else {
        is_ready[name] = false;
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 35 mins to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 547..553

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

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

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

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

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

Refactorings

Further Reading

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

    this.next = DcmgrGUI.Util.createUIButton(this.element.find('.next'),{
      disabled : true,
      text : false
    });
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 35 mins to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 206..209

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

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

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

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

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

Refactorings

Further Reading

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

    this.prev = DcmgrGUI.Util.createUIButton(this.element.find('.prev'),{
      disabled : true,
      text : false
    });
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js and 1 other location - About 35 mins to fix
frontend/dcmgr_gui/public/javascripts/dcmgr_gui/core.js on lines 210..213

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

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

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

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

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

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status