activescaffold/active_scaffold

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

Summary

Maintainability
F
1 wk
Test Coverage

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

if (typeof Prototype == 'undefined')
{
  warning = "ActiveScaffold Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (e.g. <%= javascript_include_tag :defaults %>) *before* it includes active_scaffold.js (e.g. <%= active_scaffold_includes %>).";
  alert(warning);
}
Severity: Major
Found in app/assets/javascripts/prototype/active_scaffold.js - About 2 days to fix

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

    var ActiveScaffold = {
      live_search: function(element) {
        $$('form.search.live input[type=search]', element).each(function(item) {
          new Form.Element.DelayedObserver(item, 0.5, function(element, value) {
            if (!$(element.id)) return false; // because the element may have been destroyed
    Severity: Minor
    Found in app/assets/javascripts/prototype/active_scaffold.js - About 5 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) {
          tbody = $(active_scaffold_id).down('tbody.records');
      
          var new_row = null;
          
      Severity: Minor
      Found in app/assets/javascripts/prototype/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 update_column has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

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

        update_column: function(element, url, send_form, source_id, val, additional_params) {
          if (!element) element = $(source_id);
          
          var as_form = element.up('form.as_form');
          var params = null;
      Severity: Minor
      Found in app/assets/javascripts/prototype/active_scaffold.js - About 1 hr to fix

        Function create_record_row has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          create_record_row: function(active_scaffold_id, html, options) {
            tbody = $(active_scaffold_id).down('tbody.records');
        
            var new_row = null;
            
        Severity: Minor
        Found in app/assets/javascripts/prototype/active_scaffold.js - About 1 hr to fix

          Function get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            get: function(element) {
              var element = $(element);
              if (typeof(element.retrieve('action_link')) === 'undefined' && !element.hasClassName('as_adapter')) {
                var parent = element.up('.actions');
                if (typeof(parent) === 'undefined') {
          Severity: Minor
          Found in app/assets/javascripts/prototype/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 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/prototype/active_scaffold.js - About 45 mins to fix

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

              setFieldFromAjax: function(url, options) {
                var ipe = this;
                $(ipe._controls.editor).remove();
                new Ajax.Request(url, {
                  method: 'get',
            Severity: Minor
            Found in app/assets/javascripts/prototype/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 create_associated_record_form has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              create_associated_record_form: function(element, content, options) {
                var element = $(element);
                if (options.singular == false) {
                  if (!(options.id && $(options.id))) {
                    element.insert(content);
            Severity: Minor
            Found in app/assets/javascripts/prototype/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 read_inplace_edit_heading_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              read_inplace_edit_heading_attributes: function(column_heading, options) {
                if (column_heading.readAttribute('data-ie-cancel-text')) options.cancelText = column_heading.readAttribute('data-ie-cancel-text');
                if (column_heading.readAttribute('data-ie-loading-text')) options.loadingText = column_heading.readAttribute('data-ie-loading-text');
                if (column_heading.readAttribute('data-ie-saving-text')) options.savingText = column_heading.readAttribute('data-ie-saving-text');
                if (column_heading.readAttribute('data-ie-save-text')) options.okText = column_heading.readAttribute('data-ie-save-text');
            Severity: Minor
            Found in app/assets/javascripts/prototype/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 replace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            Element.replace = function(element, html) {
              element = $(element);
              if (element.outerHTML) {
                try {
                element.outerHTML = html.stripScripts();
            Severity: Minor
            Found in app/assets/javascripts/prototype/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 stripe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              stripe: function(tbody_id) {
                var even = false;
                var rows = this.records_for(tbody_id);
                for (var i = 0; i < rows.length; i++) {
                  var child = rows[i];
            Severity: Minor
            Found in app/assets/javascripts/prototype/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 clonePatternField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              clonePatternField: function() {
                var patternNodes = this.getPatternNodes(this.options.inplacePatternSelector);
                if (patternNodes.editNode == null) {
                  alert('did not find any matching node for ' + this.options.editFieldSelector);
                  return;
            Severity: Minor
            Found in app/assets/javascripts/prototype/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

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

              render_form_field: function(source, content, options) {
                var source = $(source);
                var element = source.up('.association-record'), selector = '';
                if (typeof(element) === 'undefined') {
                  element = source.up('ol.form');
            Severity: Minor
            Found in app/assets/javascripts/prototype/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

              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/prototype/active_scaffold.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/jquery/active_scaffold.js on lines 1426..1434

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

            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_form: function(as_form) {
                as_form = $(as_form)
                var loading_indicator = $(as_form.readAttribute('id').sub('-form', '-loading-indicator'));
                if (loading_indicator) loading_indicator.style.visibility = 'visible';
                as_form.disable();
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 527..532

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

            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_form: function(as_form) {
                as_form = $(as_form)
                var loading_indicator = $(as_form.readAttribute('id').sub('-form', '-loading-indicator'));
                if (loading_indicator) loading_indicator.style.visibility = 'hidden';
                as_form.enable();
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 520..525

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

            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() {
                this.set.links.each(function(item) {
                  if (item.url != this.url) return;
                  item.tag.removeClassName('disabled');
                }.bind(this));
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 1103..1108

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

            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() {
                this.set.links.each(function(item) {
                  if (item.url != this.url) return;
                  item.tag.addClassName('disabled');
                }.bind(this));
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 1096..1101

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

            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
                scaffold = $(scaffold)
                count = scaffold.select('span.active-scaffold-records').last();
                if (count) count.update(parseInt(count.innerHTML, 10) + 1);
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 462..467

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

            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

              decrement_record_count: function(scaffold) {
                // decrement the last record count, firsts record count are in nested lists
                scaffold = $(scaffold)
                count = scaffold.select('span.active-scaffold-records').last();
                if (count) count.update(parseInt(count.innerHTML, 10) - 1);
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 468..473

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

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

            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

            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.href = l.url;
                }
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 1127..1130

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 59.

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

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

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

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

            Refactorings

            Further Reading

            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.href = l.url;
                }
            Severity: Major
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 1036..1039

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 59.

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

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

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

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

            Refactorings

            Further Reading

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

                Element[(element.value == 'PAST' || element.value == 'FUTURE') ? 'show' : 'hide'](element.readAttribute('id').sub('_opt', '_trend'));
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 55 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 302..302

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

            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

                Element[(element.value == 'null' || element.value == 'not_null') ? 'hide' : 'show'](element.readAttribute('id').sub('_opt', '_numeric'));
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 55 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 308..308

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

            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/prototype/active_scaffold.js and 1 other location - About 55 mins to fix
            app/assets/javascripts/jquery/active_scaffold.js on lines 1189..1190

            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

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

              document.on('ajax:failure', 'a.as_paginate', function(event) {
                var as_scaffold = event.findElement('.active-scaffold');
                ActiveScaffold.report_500_response(as_scaffold);
                return true;
              });
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 40 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 149..153

            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

              document.on('ajax:failure', 'a.as_sort', function(event) {
                var as_scaffold = event.findElement('.active-scaffold');
                ActiveScaffold.report_500_response(as_scaffold);
                return true;
              });
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 40 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 240..244

            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

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

            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

                else if (this.position == 'before') {
                  this.target.insert({before:content});
                  this.set_adapter(this.target.previous());
                }
                else {
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 1063..1073

            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 (options.insert_at.after) {
                    insert_method = 'after';
                    get_method = 'next';
                  } else {
                    insert_method = 'before';
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/jquery/active_scaffold.js on lines 775..781

            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.down('input[type="checkbox"]'), options);
                  } else {
                    ActiveScaffold.create_inplace_editor(span, options);
                  }
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/jquery/active_scaffold.js on lines 1072..1076

            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

              document.on('mouseover', 'td.in_place_editor_field', function(event) {
                  event.findElement('td.in_place_editor_field').select('span').invoke('addClassName', 'hover');
              });
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 157..159

            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 (this.position == 'after') {
                  this.target.insert({after:content});
                  this.set_adapter(this.target.next());
                }
                else if (this.position == 'before') {
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 1067..1073

            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

              document.on('mouseout', 'td.in_place_editor_field', function(event) {
                  event.findElement('td.in_place_editor_field').select('span').invoke('removeClassName', 'hover');
              });
            Severity: Minor
            Found in app/assets/javascripts/prototype/active_scaffold.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/prototype/active_scaffold.js on lines 154..156

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 47.

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

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

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

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

            Refactorings

            Further Reading

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

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

            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

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

            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