Showing 27 of 27 total issues

File jquery-migrate-1.3.0.js has 500 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery Migrate - v1.3.0 - 2016-01-13
 * Copyright jQuery Foundation and other contributors
 */
(function( jQuery, window, undefined ) {
Severity: Minor
Found in app/assets/javascripts/redde/redactor/jquery-migrate-1.3.0.js - About 1 day to fix

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

                        if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
                            this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
                        else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
                            this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
    app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js on lines 64..67

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

    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.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
                            this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
                        else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
                            this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
    app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js on lines 69..72

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

    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.pageX - $(document).scrollLeft() < o.scrollSensitivity)
                            scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
                        else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
                            scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
    app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js on lines 76..79

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

    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.pageY - $(document).scrollTop() < o.scrollSensitivity)
                            scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
                        else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
                            scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
    app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js on lines 81..84

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

    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

    Function _mouseDrag has 115 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _mouseDrag: function(event) {
    
                //Compute the helpers position
                this.position = this._generatePosition(event);
                this.positionAbs = this._convertPositionTo("absolute");
    Severity: Major
    Found in app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js - About 4 hrs to fix

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

                  if (previousItem != null) {
                      while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
                          if (previousItem[0].previousSibling) {
                              previousItem = $(previousItem[0].previousSibling);
                          } else {
      app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js on lines 157..166

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

      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 (nextItem != null) {
              while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
                if (nextItem[0].nextSibling) {
                  nextItem = $(nextItem[0].nextSibling);
                } else {
      app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js on lines 144..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 116.

      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

      File jquery.mjs.nestedSortable.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * jQuery UI Nested Sortable
       * v 1.3.5 / 21 jun 2012
       * http://mjsarfatti.com/code/nestedSortable
       *
      Severity: Minor
      Found in app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js - About 3 hrs to fix

        Class ScaffoldGenerator has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class ScaffoldGenerator < ::Rails::Generators::Base
              source_root File.expand_path('../templates', __FILE__)
              argument :controller_path, type: :string
              argument :model_name, type: :string, required: false
        
        
        Severity: Minor
        Found in lib/generators/redde/scaffold/scaffold_generator.rb - About 2 hrs to fix

          Function attr has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jQuery.attr = function( elem, name, value, pass ) {
              var lowerName = name.toLowerCase(),
                  nType = elem && elem.nodeType;
          
              if ( pass ) {
          Severity: Minor
          Found in app/assets/javascripts/redde/redactor/jquery-migrate-1.3.0.js - About 1 hr to fix

            Function toArray has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    toArray: function(options) {
            
                        var o = $.extend({}, this.options, options),
                            sDepth = o.startDepthCount || 0,
                            ret = [],
            Severity: Minor
            Found in app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js - About 1 hr to fix

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

                  jQuery.Deferred = function( func ) {
                      var deferred = oldDeferred(),
                          promise = deferred.promise();
              
                      deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
              Severity: Minor
              Found in app/assets/javascripts/redde/redactor/jquery-migrate-1.3.0.js - About 1 hr to fix

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

                jQuery.fn.init = function( selector, context, rootjQuery ) {
                    var match, ret;
                
                    if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
                            (match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
                Severity: Minor
                Found in app/assets/javascripts/redde/redactor/jquery-migrate-1.3.0.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if (!o.isAllowed(this.currentItem, parentItem) ||
                                  parentItem && parentItem.hasClass(o.disableNesting) ||
                                  o.protectRoot && (parentItem == null && !isRoot || isRoot && level > 1)) {
                                      this.placeholder.addClass(o.errorClass);
                                      if (maxLevels < levels && maxLevels != 0) {
                  Severity: Critical
                  Found in app/assets/javascripts/redde/sortTree/jquery.mjs.nestedSortable.js - About 1 hr to fix

                    Method default_name_for has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def default_name_for(column)
                            case column.to_s
                            when 'title' then 'Заголовок'
                            when 'name' then 'Название'
                            when 'slug' then 'URL'
                    Severity: Minor
                    Found in lib/generators/redde/scaffold/scaffold_generator.rb - About 1 hr to fix

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

                            content_tag(:span, class: ['redde-form__file rfile jsr-file', options[:class]]) do
                              concat content_tag :span, raw('Загрузить') + content_tag(:span, file_field(name, options.merge(class: 'rfile__inp')), class: 'rfile__wrap jsr-file--wrap'), class: 'rfile__btn btn icon-upload'
                              concat content_tag(:span, '', class: 'rfile__name jsr-file--name')
                              concat content_tag(:span, raw('&nbsp;'), title: 'удалить', class: 'rfile__del jsr-file--del', hidden: "")
                      Severity: Major
                      Found in app/form_builders/redde_form_builder.rb and 1 other location - About 1 hr to fix
                      app/helpers/redde/admin_helper.rb on lines 5..8

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 51.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          content_tag(:span, class: ['redde-form__file rfile jsr-file', options[:class]]) do
                            concat content_tag :span, raw('Загрузить') + content_tag(:span, file_field_tag(name, options.merge(class: 'rfile__inp')), class: 'rfile__wrap jsr-file--wrap'), class: 'rfile__btn btn icon-upload'
                            concat content_tag(:span, '', class: 'rfile__name jsr-file--name')
                            concat content_tag(:span, raw('&nbsp;'), title: 'удалить', class: 'rfile__del jsr-file--del', hidden: "")
                      Severity: Major
                      Found in app/helpers/redde/admin_helper.rb and 1 other location - About 1 hr to fix
                      app/form_builders/redde_form_builder.rb on lines 57..60

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 51.

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

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

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

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

                      Refactorings

                      Further Reading

                      Method redde_form_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def redde_form_for(object, options = {}, &block)
                          options = make_options(options)
                          options[:builder] ||= ReddeFormBuilder
                          options[:html] = { 'data-redde' => { objectName: (object.kind_of?(Array) ? object.last : object).class.model_name.param_key }.to_json }
                      
                      
                      Severity: Minor
                      Found in app/helpers/redde/form_helper.rb - 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 clean has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          jQuery.clean = function( elems, context, fragment, scripts ) {
                              // Set context per 1.8 logic
                              context = context || document;
                              context = !context.nodeType && context[0] || context;
                              context = context.ownerDocument || context;
                      Severity: Minor
                      Found in app/assets/javascripts/redde/redactor/jquery-migrate-1.3.0.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language