ging/social_stream

View on GitHub

Showing 172 of 172 total issues

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

      Function Timeline has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      SocialStream.Timeline = (function(SS, $, undefined){
        var callback = new SS.Callback();
      
        var initModalCarousel = function() {
          var elements = $('.timeline [data-modal-carousel-id="false"]');
      Severity: Minor
      Found in base/app/assets/javascripts/social_stream/timeline.js - About 1 hr to fix

        Function tiesGraph has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          $.fn.tiesGraph = function( data ) {
            //TODO: better handling of width and height
            var w = 860,
            h = 500,
            fill = d3.scale.category20();
        Severity: Minor
        Found in base/app/assets/javascripts/social_stream/tie.js - About 1 hr to fix

          Method save_buddy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

                  def save_buddy
                    
                    unless SocialStream::Presence.enable
                      return
                    end
          Severity: Minor
          Found in presence/lib/social_stream/presence/models/buddy_manager.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 create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              super do |format|
                format.json { render :json => resource.to_json(helper: self), status: :created }
                format.js
                format.all {
          Severity: Minor
          Found in documents/app/controllers/documents_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 Wall has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          SocialStream.Documents.Wall = (function(SS, $, undefined) {
            var initWall = function() {
              $('<label/>', {
                "for": 'new_document_title',
                style: 'display: none;',
          Severity: Minor
          Found in documents/app/assets/javascripts/social_stream/documents.wall.js - About 1 hr to fix

            Method notification_subject has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def notification_subject
                sender_name= sender.name.truncate(30, :separator => ' ')
                receiver_name= receiver.name.truncate(30, :separator => ' ')
                case verb 
                  when 'like'
            Severity: Minor
            Found in base/app/models/activity.rb - About 1 hr to fix

              Function storeConversations has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var storeConversations = function() {
                    var chatboxes = PRESENCE.WINDOW.getAllChatBoxes();
                    var pvisibleChatBoxes = PRESENCE.WINDOW.getVisibleChatBoxes();
                    var storedSlugs = [];
                    var storedGroupSlugs = [];
              Severity: Minor
              Found in presence/app/assets/javascripts/presence_persistence.js - About 1 hr to fix

                Function initWall has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var initWall = function() {
                    $('<label/>', {
                      "for": 'new_document_title',
                      style: 'display: none;',
                      text: I18n.t('activerecord.attributes.document.title')
                Severity: Minor
                Found in documents/app/assets/javascripts/social_stream/documents.wall.js - About 1 hr to fix

                  Method executeRemoteCommands has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def executeRemoteCommands(commands)
                              if commands.empty?
                                return "No command received";
                              end
                              
                  Severity: Minor
                  Found in presence/lib/social_stream/presence/xmpp_server_order.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 createChatBox has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      var createChatBox = function(guest_slug,isGroup){
                      
                          var guest_name = PRESENCE.XMPPClient.getNameFromSlug(guest_slug)
                          
                          if(isGroup){
                  Severity: Minor
                  Found in presence/app/assets/javascripts/presence_windowManager.js - About 1 hr to fix

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

                    SocialStream.Wall = (function(SS, $, undefined){
                      var callback = new SS.Callback();
                    
                    
                      var initInputAutosize = function() {
                    Severity: Minor
                    Found in base/app/assets/javascripts/social_stream/wall.js - About 1 hr to fix

                      Function Event has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      SocialStream.Event = (function(SS, $, undefined) {
                        var callback = new SS.Callback();
                      
                        var color = function(){
                          return SS.Events.current.eventColor;
                      Severity: Minor
                      Found in events/app/assets/javascripts/social_stream/event.js - 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 mailboxer_email has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def mailboxer_email(object)
                          #If actor has disabled the emails, return nil.
                          return nil if !notify_by_email
                          #If actor has enabled the emails and has email
                          return "#{name} <#{email}>" if email.present?
                      Severity: Minor
                      Found in base/app/models/actor.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 urlDetect has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        var urlDetect = function() {
                          this.currentValue = $("#post_text").val();
                      
                          if (this.lastValue === null) {
                            this.lastValue = "";
                      Severity: Minor
                      Found in linkser/app/assets/javascripts/social_stream/linkser.wall.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language