ging/social_stream

View on GitHub

Showing 123 of 172 total issues

File actor.rb has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Actor < ActiveRecord::Base
  # Actor is a supertype of all subjects defined in SocialStream.subjects
  supertype_of :subject

  include SocialStream::Models::Object
Severity: Minor
Found in base/app/models/actor.rb - About 4 hrs to fix

    Function Contact has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    SocialStream.Contact = (function($, SS, undefined) {
      var callback = new SS.Callback();
    
      var getForms = function(id) {
        return $('[data-contact_id="' + id + '"]');
    Severity: Minor
    Found in base/app/assets/javascripts/social_stream/contact.js - 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 FullCalendar has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    SocialStream.FullCalendar = (function(SS, $, Scheduler, undefined){
      var callback = new SS.Callback(),
          current,
          eventColor = 'gray';
    
    
    Severity: Major
    Found in events/app/assets/javascripts/social_stream/fullcalendar.js - About 4 hrs to fix

      Class Activity has 34 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Activity < ActiveRecord::Base
        # FIXME: this does not follow the Rails way
        include NotificationsHelper
      
        # This has to be declared before 'has_ancestry' to work around rails issue #670
      Severity: Minor
      Found in base/app/models/activity.rb - About 4 hrs to fix

        Function wire has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            wire: function() {
              var self = this;
        
              this.input.click(function() {
                self.lastAbbreviation = null;
        Severity: Major
        Found in presence/app/assets/javascripts/jquery.flexselect.sstreampresence.js - About 3 hrs to fix

          File jquery.ui.chatbox.sstreampresence.js has 307 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           * Copyright 2010, Wen Pu (dexterpu at gmail dot com)
           * Dual licensed under the MIT or GPL Version 2 licenses.
           * http://jquery.org/license
           *
          Severity: Minor
          Found in presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js - About 3 hrs to fix

            Function Wall has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            SocialStream.Linkser.Wall = (function(SS, $) {
              var callback = new SS.Callback();
              var regexp = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&;:\/~+#-]*[\w@?^=%&;\/~+#-])?$/
            
              var urlDetect = function() {
            Severity: Minor
            Found in linkser/app/assets/javascripts/social_stream/linkser.wall.js - 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

            Method initialize has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def initialize(subject)
                    
                    #Download alias action
                    alias_action :download, :to => :read
                    alias_action :original, :to => :read
            Severity: Major
            Found in base/lib/social_stream/base/ability.rb - About 2 hrs to fix

              File activity.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class Activity < ActiveRecord::Base
                # FIXME: this does not follow the Rails way
                include NotificationsHelper
              
                # This has to be declared before 'has_ancestry' to work around rails issue #670
              Severity: Minor
              Found in base/app/models/activity.rb - About 2 hrs to fix

                Function SearchHeader has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                SocialStream.SearchHeader = (function(SS, $, undefined){
                  var callback = new SS.Callback();
                
                  var nav, mat, timestamp_query, new_query;
                  var MIN_TIME_BETWEEN_QUERIES = 1200; // ms
                Severity: Major
                Found in base/app/assets/javascripts/social_stream/search_header.js - About 2 hrs to fix

                  Function Wall has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  SocialStream.Linkser.Wall = (function(SS, $) {
                    var callback = new SS.Callback();
                    var regexp = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&;:\/~+#-]*[\w@?^=%&;\/~+#-])?$/
                  
                    var urlDetect = function() {
                  Severity: Major
                  Found in linkser/app/assets/javascripts/social_stream/linkser.wall.js - About 2 hrs to fix

                    Function initialize has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function initialize() {
                      var map = Gmaps.map.serviceObject;
                    
                      var input = document.getElementById('place_title');
                      var autocomplete = new google.maps.places.Autocomplete(input);
                    Severity: Major
                    Found in places/app/assets/javascripts/form.js - About 2 hrs to fix

                      Function Object has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      SocialStream.Object = (function(SS, $, undefined){
                        var callback = new SS.Callback(),
                            pIcon = '<i class="icon_tool16-private"></i>';
                      
                      
                      
                      Severity: Major
                      Found in base/app/assets/javascripts/social_stream/object.js - About 2 hrs to fix

                        Class ActivityObject has 24 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class ActivityObject < ActiveRecord::Base
                          attr_reader :_activity_parent_id
                        
                          # ActivityObject is a supertype of SocialStream.objects
                          supertype_of :object
                        Severity: Minor
                        Found in base/app/models/activity_object.rb - About 2 hrs to fix

                          Method generate_token has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def generate_token(opts = {})
                                {:session_id=>nil, :create_time=>nil, :expire_time=>nil, :role=>nil, :connection_data=>nil}.merge!(opts)
                          
                                create_time = opts[:create_time].nil? ? Time.now  :  opts[:create_time]
                                session_id = opts[:session_id].nil? ? '' : opts[:session_id]
                          Severity: Minor
                          Found in presence/lib/OpenTok/OpenTokSDK.rb - About 2 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 Comment has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                          SocialStream.Comment = (function(SS, $, undefined){
                            var callback = new SS.Callback();
                          
                            var elAlwaysHidden = [
                              "input[type=submit]"
                          Severity: Minor
                          Found in base/app/assets/javascripts/social_stream/comment.js - About 2 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 parseWord has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function parseWord(word){ 
                                
                                //Look for empty or simple words
                                if ((word.trim()=="")||(word.match(simple_word_pattern)!=null)){
                                  return word
                          Severity: Major
                          Found in presence/app/assets/javascripts/presence_parser.js - About 2 hrs to fix

                            Method updateSettings has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def updateSettings
                                
                                success = false
                            
                                #If no section selected, skips and gives error
                            Severity: Minor
                            Found in presence/app/controllers/xmpp_controller.rb - About 2 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

                            Method index has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def index
                                @search_result =
                                  if params[:q].blank? || params[:q].strip.size < SocialStream::Search::MIN_QUERY
                                    Kaminari.paginate_array([])
                                  elsif params[:mode] == "quick"
                            Severity: Minor
                            Found in base/app/controllers/search_controller.rb - About 2 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 contact.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // require jquery.ba-url
                            //
                            //= require social_stream/callback
                            
                            SocialStream.Contact = (function($, SS, undefined) {
                            Severity: Minor
                            Found in base/app/assets/javascripts/social_stream/contact.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language