crowbar/crowbar-core

View on GitHub
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js

Summary

Maintainability
F
4 days
Test Coverage

Function registerEvents has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  DynamicTable.prototype.registerEvents = function() {
    var self = this;

    self.root.find('[data-add]').live('click', function(event) {
      self.prepareJson();
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 6 hrs to fix

File dynamicTable.js has 379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

;(function($, doc, win) {
  'use strict';

  function DynamicTable(el, options) {
    this.root = $(el);
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 5 hrs to fix

Function parseValue has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  DynamicTable.prototype.parseValue = function(type, value) {
    switch (type) {
      case 'string':
        return value.toString();
        break;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 1 hr to fix

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

  DynamicTable.prototype.renderEntries = function() {
    var self = this;

    var data = self.json;
    var namespace = self.options.namespace.split('/');
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 1 hr to fix

Function duplicateEntry has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  DynamicTable.prototype.duplicateEntry = function() {
    if (this.options.key == false) {
      return false;
    }

Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 1 hr to fix

Function invalidEntry has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  DynamicTable.prototype.invalidEntry = function() {
    var optionals = this.options.optional.toString().split(',');
    var isInvalid = false;
    var invalidInput = false

Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 1 hr to fix

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

    while (namespace.length > 0) {
      var current_namespace = namespace.shift();

      if (!data[current_namespace]) {
        data[current_namespace] = {};
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 215..223
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 260..268
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 305..313
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 336..344
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 378..386
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 112..120
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 135..143
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 164..172

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

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

      while (namespace.length > 1) {
        var current_namespace = namespace.shift();

        if (!data[current_namespace]) {
          data[current_namespace] = {};
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 80..88
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 215..223
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 305..313
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 336..344
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 378..386
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 112..120
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 135..143
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 164..172

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

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

      while (namespace.length > 1) {
        var current_namespace = namespace.shift();

        if (!data[current_namespace]) {
          data[current_namespace] = {};
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 80..88
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 215..223
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 260..268
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 305..313
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 378..386
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 112..120
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 135..143
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 164..172

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

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

      while (namespace.length > 1) {
        var current_namespace = namespace.shift();

        if (!data[current_namespace]) {
          data[current_namespace] = {};
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 80..88
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 215..223
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 260..268
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 336..344
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 378..386
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 112..120
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 135..143
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 164..172

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

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

    while (namespace.length > 1) {
      var current_namespace = namespace.shift();

      if (!data[current_namespace]) {
        data[current_namespace] = {};
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 80..88
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 215..223
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 260..268
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 305..313
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 336..344
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 112..120
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 135..143
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 164..172

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

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

      while (namespace.length > 1) {
        var current_namespace = namespace.shift();

        if (!data[current_namespace]) {
          data[current_namespace] = {};
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 80..88
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 260..268
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 305..313
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 336..344
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 378..386
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 112..120
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 135..143
crowbar_framework/vendor/assets/javascripts/jquery/jsonAttribute.js on lines 164..172

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

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

  DynamicTable.prototype.prepareTemplate = function() {
    this.entriesTemplate = Handlebars.compile(
      $(this.options.entries).html()
    );
  };
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 47..51

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

  DynamicTable.prototype.prepareJson = function() {
    this.json = JSON.parse(
      $(this.options.storage).val()
    );
  };
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 41..45

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

      case 'array-integer':
        value = this.splitValue(value);

        for (i in value) {
          value[i] = parseInt(value[i]);
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 454..462

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

      case 'array-float':
        value = this.splitValue(value);

        for (i in value) {
          value[i] = parseFloat(value[i]);
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 445..453

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 (self.invalidEntry()) {
        self.root.after(
          $.dangerMessage(
            self.options.invalid,
            true,
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 159..169

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

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.duplicateEntry()) {
        self.root.after(
          $.dangerMessage(
            self.options.duplicate,
            true,
crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js on lines 147..157

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

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

  DynamicTable.prototype.initialize = function() {
    this.prepareTemplate();
    this.prepareJson();
    this.registerEvents();
    this.renderEntries();
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 10411..10416

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

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

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

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

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

Refactorings

Further Reading

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

  $.fn.dynamicTable = function(options) {
    return this.each(function() {
      new DynamicTable(this, options);
    });
  };
crowbar_framework/vendor/assets/javascripts/jquery/changeDetection.js on lines 70..74
crowbar_framework/vendor/assets/javascripts/jquery/hideShowClusterConf.js on lines 47..51
crowbar_framework/vendor/assets/javascripts/jquery/hideShowText.js on lines 120..124
crowbar_framework/vendor/assets/javascripts/jquery/ledUpdate.js on lines 256..260
crowbar_framework/vendor/assets/javascripts/jquery/listSearch.js on lines 62..66
crowbar_framework/vendor/assets/javascripts/jquery/updateAttribute.js on lines 60..64

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

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