ging/social_stream

View on GitHub

Showing 123 of 172 total issues

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

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

                    SocialStream.Explore = (function(SS, $, undefined){
                      var callback = new SS.Callback();
                    
                      var headerPushState = function() {
                        $('#explore-header div').on('shown', function(e) {
                    Severity: Minor
                    Found in base/app/assets/javascripts/social_stream/explore.js - About 1 hr to fix

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

                      SocialStream.Pagination = (function(SS, $, undefined){
                      
                        var show = function(callback) {
                          var nav = $('nav.more');
                      
                      
                      Severity: Minor
                      Found in base/app/assets/javascripts/social_stream/pagination.js - About 1 hr to fix

                        Function Tag has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        SocialStream.Tag = (function(SS, $, undefined) {
                          // Select2
                          var select2 = function(selector) {
                            $(selector).select2({
                              multiple: true,
                        Severity: Minor
                        Found in base/app/assets/javascripts/social_stream/tag.js - About 1 hr to fix

                          Method update_all has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def update_all
                              success = false
                          
                              #If no section selected, skips and gives error
                              if params[:settings_section].present?
                          Severity: Minor
                          Found in base/app/controllers/settings_controller.rb - About 1 hr to fix

                            Function SearchHeader has a Cognitive Complexity of 12 (exceeds 5 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: Minor
                            Found in base/app/assets/javascripts/social_stream/search_header.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

                            Function prototype has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            SocialStream.Callback.prototype = (function(SS, $, undefined) {
                              var register = function() {
                                var callback = this,
                                    funcs    = Array.prototype.slice.call(arguments),
                                    name     = funcs.shift();
                            Severity: Minor
                            Found in base/app/assets/javascripts/social_stream/callback.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language