bborn/communityengine

View on GitHub

Showing 147 of 147 total issues

Function Jcrop has 1311 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $.Jcrop = function (obj, opt) {
    var options = $.extend({}, $.Jcrop.defaults),
        docOffset, lastcurs, ie6mode = false;

    // Internal Methods {{{
Severity: Major
Found in app/assets/javascripts/jcrop/jquery.Jcrop.js - About 6 days to fix

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

    /**
     * jquery.Jcrop.js v0.9.10
     * jQuery Image Cropping Plugin - released under MIT License 
     * Author: Kelly Hallman <khallman@gmail.com>
     * http://github.com/tapmodo/Jcrop
    Severity: Major
    Found in app/assets/javascripts/jcrop/jquery.Jcrop.js - About 3 days to fix

      Function Coords has 252 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var Coords = (function () {
            var x1 = 0,
                y1 = 0,
                x2 = 0,
                y2 = 0,
      Severity: Major
      Found in app/assets/javascripts/jcrop/jquery.Jcrop.js - About 1 day to fix

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

        /*!
         * jQuery Color Animations v2.0pre
         * http://jquery.org/
         *
         * Copyright 2011 John Resig
        Severity: Major
        Found in app/assets/javascripts/jcrop/jquery.color.js - About 1 day to fix

          Function Selection has 213 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var Selection = (function () {
                var awake,
                    hdep = 370,
                    borders = {},
                    handle = {},
          Severity: Major
          Found in app/assets/javascripts/jcrop/jquery.Jcrop.js - About 1 day to fix

            Class User has 57 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class User < ActiveRecord::Base
              extend FriendlyId
              include UrlUpload
              include FacebookProfile
              include TwitterProfile
            Severity: Major
            Found in app/models/user.rb - About 1 day to fix

              Function _create has 146 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _create: function() {
                          // for handling static scoping inside callbacks
                          var that = this;
              
                          // There are 2 kinds of DOM nodes this widget can be instantiated on:
              Severity: Major
              Found in app/assets/javascripts/tag-it/tag-it.js - About 5 hrs to fix

                File tag-it.js has 402 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                * jQuery UI Tag-it!
                *
                * @version v2.0 (06/2011)
                *
                Severity: Minor
                Found in app/assets/javascripts/tag-it/tag-it.js - About 5 hrs to fix

                  Class UsersController has 39 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class UsersController < BaseController
                    include Viewable
                    cache_sweeper :taggable_sweeper, :only => [:activate, :update, :destroy]
                  
                    before_action :login_required, :only => [:edit, :edit_account, :update, :welcome_photo, :welcome_about,
                  Severity: Minor
                  Found in app/controllers/users_controller.rb - About 5 hrs to fix

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

                    /*!
                     * jQuery Migrate - v1.2.1 - 2013-05-08
                     * https://github.com/jquery/jquery-migrate
                     * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
                     */
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.migrate.js - About 5 hrs to fix

                      Method page_title has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def page_title
                          divider = " | ".html_safe
                      
                          app_base = configatron.community_name
                          tagline = " #{divider} #{configatron.community_tagline}"
                      Severity: Minor
                      Found in app/helpers/base_helper.rb - About 5 hrs to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      File users_controller.rb has 367 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class UsersController < BaseController
                        include Viewable
                        cache_sweeper :taggable_sweeper, :only => [:activate, :update, :destroy]
                      
                        before_action :login_required, :only => [:edit, :edit_account, :update, :welcome_photo, :welcome_about,
                      Severity: Minor
                      Found in app/controllers/users_controller.rb - About 4 hrs to fix

                        File user.rb has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'digest/sha1'
                        require 'bcrypt'
                        
                        class User < ActiveRecord::Base
                          extend FriendlyId
                        Severity: Minor
                        Found in app/models/user.rb - About 4 hrs to fix

                          Method container_title has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def container_title
                              app_base = configatron.community_name
                              title = app_base
                          
                              case controller.controller_name
                          Severity: Minor
                          Found in app/helpers/base_helper.rb - About 4 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function Shade has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var Shade = (function() {
                                var enabled = false,
                                    holder = $('<div />').css({
                                      position: 'absolute',
                                      zIndex: 240,
                          Severity: Major
                          Found in app/assets/javascripts/jcrop/jquery.Jcrop.js - About 4 hrs to fix

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

                                    } else if (xx < x1) { // left side
                                      if (x1 - xx < min_x) {
                                        xx = x1 - min_x;
                                      } else if (x1 - xx > max_x) {
                                        xx = x1 - max_x;
                            Severity: Major
                            Found in app/assets/javascripts/jcrop/jquery.Jcrop.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/jcrop/jquery.Jcrop.js on lines 580..602

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

                            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 (xx > x1) { // right side
                                      if (xx - x1 < min_x) {
                                        xx = x1 + min_x;
                                      } else if (xx - x1 > max_x) {
                                        xx = x1 + max_x;
                            Severity: Major
                            Found in app/assets/javascripts/jcrop/jquery.Jcrop.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/jcrop/jquery.Jcrop.js on lines 591..602

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

                            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 base_helper.rb has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'digest/md5'
                            
                            # Methods added to this helper will be available to all templates in the application.
                            module BaseHelper
                              include ActsAsTaggableOn::TagsHelper
                            Severity: Minor
                            Found in app/helpers/base_helper.rb - About 3 hrs to fix

                              Method atom_feed_for has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def atom_feed_for(resources, options = {})
                                    xml = Builder::XmlMarkup.new(:indent => 2)
                              
                                    options[:feed]       ||= {}
                                    options[:item]       ||= {}
                              Severity: Minor
                              Found in lib/resource_feeder/atom.rb - About 3 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function getFixed has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    function getFixed() //{{{
                                    {
                                      if (!options.aspectRatio) {
                                        return getRect();
                                      }
                              Severity: Major
                              Found in app/assets/javascripts/jcrop/jquery.Jcrop.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language