dalpo/rails_admin_nestable

View on GitHub
app/assets/javascripts/rails_admin/jquery.nestable.js

Summary

Maintainability
F
3 days
Test Coverage

File jquery.nestable.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
 * Dual-licensed under the BSD or MIT licenses
 */
;(function($, window, document, undefined)
Severity: Minor
Found in app/assets/javascripts/rails_admin/jquery.nestable.js - About 5 hrs to fix

    Function dragMove has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            dragMove: function(e)
            {
                var list, parent, prev, next, depth,
                    opt   = this.options,
                    mouse = this.mouse;
    Severity: Major
    Found in app/assets/javascripts/rails_admin/jquery.nestable.js - About 4 hrs to fix

      Function init has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              init: function()
              {
                  var list = this;
      
                  list.reset();
      Severity: Major
      Found in app/assets/javascripts/rails_admin/jquery.nestable.js - About 2 hrs to fix

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

                dragStart: function(e)
                {
                    var mouse    = this.mouse,
                        target   = $(e.target),
                        dragItem = target.closest(this.options.itemNodeName);
        Severity: Minor
        Found in app/assets/javascripts/rails_admin/jquery.nestable.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                          if (!handle.length || list.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
                              return;
                          }
          Severity: Major
          Found in app/assets/javascripts/rails_admin/jquery.nestable.js - About 40 mins to fix

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

                        if (lists.length) {
                            li.addClass(this.options.collapsedClass);
                            li.children('[data-action="collapse"]').hide();
                            li.children('[data-action="expand"]').show();
                            li.children(this.options.listNodeName).hide();
            Severity: Major
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 197..202

            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

                    {
                        li.removeClass(this.options.collapsedClass);
                        li.children('[data-action="expand"]').hide();
                        li.children('[data-action="collapse"]').show();
                        li.children(this.options.listNodeName).show();
            Severity: Major
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 207..212

            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

                    collapseAll: function()
                    {
                        var list = this;
                        list.el.find(list.options.itemNodeName).each(function() {
                            list.collapseItem($(this));
            Severity: Major
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 215..221

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 68.

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

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

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

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

            Refactorings

            Further Reading

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

                    expandAll: function()
                    {
                        var list = this;
                        list.el.find(list.options.itemNodeName).each(function() {
                            list.expandItem($(this));
            Severity: Major
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 223..229

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 68.

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

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

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

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

            Refactorings

            Further Reading

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

                        var onMoveEvent = function(e)
                        {
                            if (list.dragEl) {
                                e.preventDefault();
                                list.dragMove(hasTouch ? e.touches[0] : e);
            Severity: Major
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 116..122

            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

                        var onEndEvent = function(e)
                        {
                            if (list.dragEl) {
                                e.preventDefault();
                                list.dragStop(hasTouch ? e.touches[0] : e);
            Severity: Major
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 108..114

            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

                        this.dragEl.css({
                            'left' : e.pageX - mouse.offsetX,
                            'top'  : e.pageY - mouse.offsetY
                        });
            Severity: Minor
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 50 mins to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 309..312

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

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

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

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

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

            Refactorings

            Further Reading

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

                        this.dragEl.css({
                            'left' : e.pageX - mouse.offsetX,
                            'top'  : e.pageY - mouse.offsetY
                        });
            Severity: Minor
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 50 mins to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 272..275

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

            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

                        mouse.offsetX = e.offsetX !== undefined ? e.offsetX : e.pageX - target.offset().left;
            Severity: Minor
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 40 mins to fix
            app/assets/javascripts/rails_admin/jquery.nestable.js on lines 256..256

            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

                        mouse.offsetY = e.offsetY !== undefined ? e.offsetY : e.pageY - target.offset().top;
            Severity: Minor
            Found in app/assets/javascripts/rails_admin/jquery.nestable.js and 1 other location - About 40 mins to fix
            app/assets/javascripts/rails_admin/jquery.nestable.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 48.

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

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

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

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

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status