activescaffold/active_scaffold

View on GitHub
app/assets/javascripts/jquery/active_scaffold.js

Summary

Maintainability
F
1 wk
Test Coverage

File active_scaffold.js has 1260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

jQuery(document).ready(function($) {
  /* It should not be needed, latest chrome is caching by itself
    if (ActiveScaffold.config.conditional_get) jQuery.ajaxSettings.ifModified = true;
    jQuery(document).on('ajax:beforeSend', function(event, xhr, settings){
      xhr.cacheUrl = settings.url;
Severity: Major
Found in app/assets/javascripts/jquery/active_scaffold.js - About 3 days to fix

    ActiveScaffold has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    var ActiveScaffold = {
      last_focus: null,
      setup: function(container) {
        /* setup some elements on page/form load */
        ActiveScaffold.load_embedded(container);
    Severity: Major
    Found in app/assets/javascripts/jquery/active_scaffold.js - About 7 hrs to fix

      Function in_place_editor_field_clicked has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

        in_place_editor_field_clicked: function(span) {
          // test editor is open
          if (typeof(span.data('editInPlace')) === 'undefined') {
            var options = {show_buttons: true,
                hover_class: 'hover',
      Severity: Minor
      Found in app/assets/javascripts/jquery/active_scaffold.js - About 6 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 update_column has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        update_column: function(element, url, send_form, source_id, val, additional_params) {
          if (!element) element = jQuery('#' + source_id);
          var as_form = element.closest('form.as_form');
          var params = null;
      
      
      Severity: Minor
      Found in app/assets/javascripts/jquery/active_scaffold.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 in_place_editor_field_clicked has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        in_place_editor_field_clicked: function(span) {
          // test editor is open
          if (typeof(span.data('editInPlace')) === 'undefined') {
            var options = {show_buttons: true,
                hover_class: 'hover',
      Severity: Major
      Found in app/assets/javascripts/jquery/active_scaffold.js - About 3 hrs to fix

        Function render_form_field has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          render_form_field: function(source, content, options) {
            if (typeof(source) == 'string') source = '#' + source;
            var source = jQuery(source);
            var element, container = source.closest('.sub-form-record'), selector = '';
            if (container.length == 0) {
        Severity: Minor
        Found in app/assets/javascripts/jquery/active_scaffold.js - About 2 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 get has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          get: function(element) {
            if (typeof(element) == 'string') element = '#' + element;
            var element = jQuery(element);
            if (element.length > 0) {
              element.data(); // $ 1.4.2 workaround
        Severity: Minor
        Found in app/assets/javascripts/jquery/active_scaffold.js - About 2 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 update_column has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          update_column: function(element, url, send_form, source_id, val, additional_params) {
            if (!element) element = jQuery('#' + source_id);
            var as_form = element.closest('form.as_form');
            var params = null;
        
        
        Severity: Major
        Found in app/assets/javascripts/jquery/active_scaffold.js - About 2 hrs to fix

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

            create_record_row: function(active_scaffold_id, html, options) {
              if (typeof(active_scaffold_id) == 'string') active_scaffold_id = '#' + active_scaffold_id;
              tbody = jQuery(active_scaffold_id).find('tbody.records').first();
              var new_row;
          
          
          Severity: Minor
          Found in app/assets/javascripts/jquery/active_scaffold.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 disable_optional_subforms has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            disable_optional_subforms: function(element) {
              jQuery('.sub-form.optional', element).each(function () {
                var $this = jQuery(this), toggle = $this.find('>.visibility-toggle');
                if (toggle.length) {
                  var hide = toggle.text() == toggle.data('show');
          Severity: Minor
          Found in app/assets/javascripts/jquery/active_scaffold.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 create_record_row has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            create_record_row: function(active_scaffold_id, html, options) {
              if (typeof(active_scaffold_id) == 'string') active_scaffold_id = '#' + active_scaffold_id;
              tbody = jQuery(active_scaffold_id).find('tbody.records').first();
              var new_row;
          
          
          Severity: Minor
          Found in app/assets/javascripts/jquery/active_scaffold.js - About 1 hr to fix

            Function create_associated_record_form has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              create_associated_record_form: function(element, content, options) {
                if (typeof(element) == 'string') element = '#' + element;
                var element = jQuery(element);
                content = jQuery(content);
                if (options.singular == false) {
            Severity: Minor
            Found in app/assets/javascripts/jquery/active_scaffold.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 extend has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Class.extend = function(prop) {
                var _super = this.prototype;
            
                // Instantiate a base class (but only create the instance,
                // don't run the init constructor)
            Severity: Minor
            Found in app/assets/javascripts/jquery/active_scaffold.js - About 1 hr to fix

              Function update_column has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                update_column: function(element, url, send_form, source_id, val, additional_params) {
              Severity: Minor
              Found in app/assets/javascripts/jquery/active_scaffold.js - About 45 mins to fix

                Function setup_history_state has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  setup_history_state: function() {
                    if (!jQuery('.active-scaffold').length) return;
                    var data = {}, current_search_item = jQuery('.active-scaffold .filtered-message[data-search]');
                    if (current_search_item.length) {
                      // store user settings enabled, update state with current page, search and sorting
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js - About 45 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 read_inplace_edit_heading_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  read_inplace_edit_heading_attributes: function(column_heading, options) {
                    if (column_heading.data('ie-cancel-text')) options.cancel_button = '<button class="inplace_cancel">' + column_heading.data('ie-cancel-text') + "</button>";
                    if (column_heading.data('ie-loading-text')) options.loading_text = column_heading.data('ie-loading-text');
                    if (column_heading.data('ie-saving-text')) options.saving_text = column_heading.data('ie-saving-text');
                    if (column_heading.data('ie-save-text')) options.save_button = '<button class="inplace_save">' + column_heading.data('ie-save-text') + "</button>";
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js - About 45 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 focus_first_element_of_form has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  focus_first_element_of_form: function(form_element, form_selector) {
                    if (typeof(form_element) == 'string') form_element = '#' + form_element;
                    if (typeof(form_selector) == 'undefined') form_selector = jQuery(form_element).is('form') ? '' : 'form ';
                    var input = jQuery(form_selector + ":input:visible:first", jQuery(form_element));
                    if (input.is('.no-autofocus :input')) return;
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.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 insert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  insert: function(content) {
                    this.close_previous_adapter();
                
                    if (this.position == 'replace') {
                      this.position = 'after';
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.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

                  decrement_record_count: function(scaffold) {
                    // decrement the last record count, firsts record count are in nested lists
                    if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
                    scaffold = jQuery(scaffold);
                    count = scaffold.find('span.active-scaffold-records').last();
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 648..654

                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

                  increment_record_count: function(scaffold) {
                    // increment the last record count, firsts record count are in nested lists
                    if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
                    scaffold = jQuery(scaffold);
                    count = scaffold.find('span.active-scaffold-records').last();
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 641..647

                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

                  set_opened: function() {
                    if (this.position == 'after') {
                      this.set_adapter(this.target.next());
                    }
                    else if (this.position == 'before') {
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 1110..1118

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

                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 (span.closest('div.active-scaffold').data('eid')) {
                        if (options['params'].length > 0) {
                          options['params'] += "&";
                        }
                        options['params'] += ("eid=" + span.closest('div.active-scaffold').data('eid'));
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 204..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 84.

                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

                  disable: function() {
                    var _this = this;
                    jQuery.each(this.set.links, function(index, item) {
                      if (item.url != _this.url) return;
                      item.tag.addClass('disabled');
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 1410..1416

                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

                  enable: function() {
                    var _this = this;
                    jQuery.each(this.set.links, function(index, item) {
                      if (item.url != _this.url) return;
                      item.tag.removeClass('disabled');
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 1418..1424

                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 (row_node.tagName != 'SCRIPT'
                        && !row.hasClass("create")
                        && !row.hasClass("update")
                        && !row.hasClass("inline-adapter")
                        && !row.hasClass("active-scaffold-calculations")) {
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 420..430

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

                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 (event.type == 'mouseenter') {
                      if (td.hasClass('empty') || typeof(span.data('editInPlace')) === 'undefined') td.find('span').addClass("hover");
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 202..204

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

                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 (event.type == 'mouseleave') {
                      if (td.hasClass('empty') || typeof(span.data('editInPlace')) === 'undefined') td.find('span').removeClass("hover");
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 199..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 64.

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

                    if (event.detail && !xhr) {
                      error = event.detail[0];
                      status = event.detail[1];
                      xhr = event.detail[2];
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 4 other locations - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 64..68
                app/assets/javascripts/jquery/active_scaffold.js on lines 170..174
                app/assets/javascripts/jquery/active_scaffold.js on lines 187..191
                app/assets/javascripts/jquery/active_scaffold.js on lines 220..224

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

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

                    if (event.detail && !xhr) {
                      error = event.detail[0];
                      status = event.detail[1];
                      xhr = event.detail[2];
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 4 other locations - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 131..135
                app/assets/javascripts/jquery/active_scaffold.js on lines 170..174
                app/assets/javascripts/jquery/active_scaffold.js on lines 187..191
                app/assets/javascripts/jquery/active_scaffold.js on lines 220..224

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

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

                    if (event.detail && !xhr) {
                      error = event.detail[0];
                      status = event.detail[1];
                      xhr = event.detail[2];
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 4 other locations - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 64..68
                app/assets/javascripts/jquery/active_scaffold.js on lines 131..135
                app/assets/javascripts/jquery/active_scaffold.js on lines 170..174
                app/assets/javascripts/jquery/active_scaffold.js on lines 187..191

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

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

                    if (event.detail && !xhr) {
                      error = event.detail[0];
                      status = event.detail[1];
                      xhr = event.detail[2];
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 4 other locations - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 64..68
                app/assets/javascripts/jquery/active_scaffold.js on lines 131..135
                app/assets/javascripts/jquery/active_scaffold.js on lines 187..191
                app/assets/javascripts/jquery/active_scaffold.js on lines 220..224

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

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

                    if (event.detail && !xhr) {
                      error = event.detail[0];
                      status = event.detail[1];
                      xhr = event.detail[2];
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 4 other locations - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 64..68
                app/assets/javascripts/jquery/active_scaffold.js on lines 131..135
                app/assets/javascripts/jquery/active_scaffold.js on lines 170..174
                app/assets/javascripts/jquery/active_scaffold.js on lines 220..224

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

                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 (l.position) {
                      l.url = l.url.append_params({adapter: '_list_inline_adapter'});
                      l.tag.attr('href', l.url);
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 1349..1352

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

                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 (l.position) {
                      l.url = l.url.append_params({adapter: '_list_inline_adapter'});
                      l.tag.attr('href', l.url);
                    }
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 1443..1446

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

                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

                    ActiveScaffold[(element.val() == 'PAST' || element.val() == 'FUTURE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_trend'));
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 292..292

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

                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

                    ActiveScaffold[(element.val() == 'null' || element.val() == 'not_null') ? 'hide' : 'show'](element.attr('id').replace(/_opt/, '_numeric'));
                Severity: Major
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 299..299

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

                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 (url.indexOf('?') == -1) url += '?';
                  else if (url.lastIndexOf('&') != url.length) url += '&';
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 875..876

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

                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

                      value = form_element.find(':checked').map(function(item){return $(this).val();}).toArray();
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 45 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 271..271

                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

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

                      value = form_element.find(':checked').map(function(item){return $(this).val();}).toArray();
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 45 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 255..255

                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

                  get_new_adapter_id: function() {
                    var id = 'adapter_';
                    var i = 0;
                    while (jQuery(id + i)) i++;
                    return id + i;
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 40 mins to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 985..990

                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

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

                      if (options.insert_at.after) {
                        insert_method = 'after';
                        get_method = 'next';
                      } else {
                        insert_method = 'before';
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 556..562

                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

                      if (mode === 'inline_checkbox') {
                        ActiveScaffold.process_checkbox_inplace_edit(span.find('input:checkbox'), options);
                      } else {
                        ActiveScaffold.create_inplace_editor(span, options);
                      }
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 223..227

                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

                  hide: function(element) {
                    if (typeof(element) == 'string') element = '#' + element;
                    jQuery(element).hide();
                  },
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 716..719

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

                  show: function(element) {
                    if (typeof(element) == 'string') element = '#' + element;
                    jQuery(element).show();
                  },
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 711..714

                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

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

                          if (select.hasClass('recordselect') || select.is('.no-options')) select = select.next(':hidden').andSelf();
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 356..356

                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

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

                      if (select.hasClass('recordselect') || select.is('.no-options')) select = select.next(':hidden').andSelf();
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 553..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 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

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

                  reload_if_empty: function(tbody, url) {
                    if (this.records_for(tbody).length == 0) {
                      this.reload(url);
                    }
                  },
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 439..443

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

                    jQuery(document).on('change input', '.active-scaffold form:not(.search) input, .active-scaffold form:not(.search) textarea, .active-scaffold form:not(.search) select', function() {
                      jQuery(this).closest('form').addClass('need-confirm');
                    });
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 30 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 1158..1160

                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

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

                      var render_url = column_heading.data('ie-render-url'),
                        mode = column_heading.data('ie-mode'),
                        record_id = span.data('ie-id') || '';
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 30 mins to fix
                app/assets/javascripts/prototype/active_scaffold.js on lines 189..191

                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

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

                    jQuery(document).on('click', '.active-scaffold .as_cancel:not([data-remote]), .active-scaffold input[type=submit]', function() {
                      jQuery(this).closest('form').removeClass('need-confirm');
                    });
                Severity: Minor
                Found in app/assets/javascripts/jquery/active_scaffold.js and 1 other location - About 30 mins to fix
                app/assets/javascripts/jquery/active_scaffold.js on lines 1155..1157

                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