bborn/communityengine

View on GitHub

Showing 106 of 147 total issues

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/jquery.migrate.js - About 1 hr to fix

    Function cropInit has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function cropInit() {
      croppable_name = '#' + croppable_id;    
      preview_name = '#' + preview_id;    
        
      // Copy the image, and insert it in an offscreen DIV
    Severity: Minor
    Found in app/assets/javascripts/cropper.js - About 1 hr to fix

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

              destroy: function() {
                  $.Widget.prototype.destroy.call(this);
      
                  this.element.unbind('.tagit');
                  this.tagList.unbind('.tagit');
      Severity: Minor
      Found in app/assets/javascripts/tag-it/tag-it.js - About 1 hr to fix

        Method rss_feed_for has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method atom_feed_for has 36 lines of code (exceeds 25 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 1 hr to fix

            Method ical has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def ical
                @calendar = RiCal.Calendar
                @calendar.add_x_property 'X-WR-CALNAME', configatron.community_name
                @calendar.add_x_property 'X-WR-CALDESC', "#{configatron.community_name} #{:events.l}"
                Event.all.each do |ce_event|
            Severity: Minor
            Found in app/controllers/events_controller.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

            Method show has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def show
                respond_to do |format|
                  format.html do
                    # see notes in base_controller.rb on how this works
                    current_user.update_last_seen_at if logged_in?
            Severity: Minor
            Found in app/controllers/topics_controller.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

            Method destroy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def destroy
                @user = User.find(params[:id])
                unless @user.admin? || @user.featured_writer?
                  @user.spam! if params[:spam] && configatron.has_key?(:akismet_key)
                  @user.destroy
            Severity: Minor
            Found in app/controllers/users_controller.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 dragmodeHandler has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function dragmodeHandler(mode, f) //{{{
                {
                  return function (pos) {
                    if (!options.aspectRatio) {
                      switch (mode) {
            Severity: Minor
            Found in app/assets/javascripts/jcrop/jquery.Jcrop.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  unless admin? || moderator? || (@post && (@post.user.eql?(current_user))) || (!@post && @user && @user.eql?(current_user))
                    redirect_to :controller => 'sessions', :action => 'new' and return false
                  end
              Severity: Critical
              Found in app/controllers/posts_controller.rb - About 1 hr to fix

                Method destroy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def destroy
                    @comment = Comment.find(params[:id])
                    if @comment.can_be_deleted_by(current_user) && @comment.destroy
                      if params[:spam] && configatron.has_key?(:akismet_key)
                        @comment.spam!
                Severity: Minor
                Found in app/controllers/comments_controller.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

                Method delete_selected has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def delete_selected
                    if params[:delete]
                      params[:delete].each { |id|
                        user = User.find(id)
                        unless user.admin? || user.featured_writer?
                Severity: Minor
                Found in app/controllers/users_controller.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

                Method show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def show
                    tag_array = ActsAsTaggableOn::DefaultParser.new( URI::decode(params[:id]) ).parse
                
                    @tags = ActsAsTaggableOn::Tag.where('name IN (?)', tag_array )
                    if @tags.nil? || @tags.empty?
                Severity: Minor
                Found in app/controllers/tags_controller.rb - About 1 hr to fix

                  Function to has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      spaces.hsla.to = function ( rgba ) {
                          if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
                              return [ null, null, null, rgba[ 3 ] ];
                          }
                          var r = rgba[ 0 ] / 255,
                  Severity: Minor
                  Found in app/assets/javascripts/jcrop/jquery.color.js - About 1 hr to fix

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

                      def create
                        @topic = Topic.includes(:forum).where(:id => params[:topic_id].to_i, :forum_id => params[:forum_id].to_i).first
                        if @topic.locked?
                          respond_to do |format|
                            format.html do
                    Severity: Minor
                    Found in app/controllers/sb_posts_controller.rb - About 1 hr to fix

                      Method create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def create
                          @user = current_user
                          @photo = Photo.new(photo_params)
                          @photo.user = @user
                          @photo.tag_list = params[:tag_list] || ''
                      Severity: Minor
                      Found in app/controllers/photos_controller.rb - About 1 hr to fix

                        Function transition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                transition: function( other, distance ) {
                                    var end = color( other ),
                                        spaceName = end._space(),
                                        space = spaces[ spaceName ],
                                        start = this[ space.cache ] || space.to( this._rgba ),
                        Severity: Minor
                        Found in app/assets/javascripts/jcrop/jquery.color.js - About 1 hr to fix

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

                            def require_ownership_or_moderator
                              @user ||= User.find(params[:user_id])
                              @post ||= Post.unscoped.find(params[:id]) if params[:id]
                              unless admin? || moderator? || (@post && (@post.user.eql?(current_user))) || (!@post && @user && @user.eql?(current_user))
                                redirect_to :controller => 'sessions', :action => 'new' and return false
                          Severity: Minor
                          Found in app/controllers/posts_controller.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

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

                            def send_to(email_addresses = '', message = '', user = nil)
                              self.invalid_emails = []
                              emails = email_addresses.split(",").collect{|email| email.strip }.uniq
                              emails.each do |email|
                                self.invalid_emails << email unless email =~ /[\w._%-]+@[\w.-]+.[a-zA-Z]{2,4}/
                          Severity: Minor
                          Found in app/models/post.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/jquery.migrate.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language