ging/social_stream

View on GitHub

Showing 123 of 172 total issues

Method find_profile_subject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def find_profile_subject
        SocialStream.profile_subject_keys.each do |type|
          id = params["#{ type }_id"]

          next if id.blank?
Severity: Minor
Found in base/lib/social_stream/controllers/helpers.rb - About 45 mins 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 setRosterForBidirectionalTie has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

          def setRosterForBidirectionalTie(userASid,userBSid,userANick,userBNick,groupForA,groupForB)
Severity: Minor
Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 45 mins to fix

    Method populate has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def populate klass, author, owner, relation_ids, &block
    Severity: Minor
    Found in base/lib/social_stream/population/activity_object.rb - About 35 mins to fix

      Method addBuddyToRoster has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                def addBuddyToRoster(userSid,buddySid,buddyNick,buddyGroup,subscription_type)
      Severity: Minor
      Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 35 mins to fix

        Method title_of has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def title_of(act_obj)
            if act_obj.is_a? Comment
              'Re: ' + title_of(act_obj.parent_post)
            elsif act_obj.respond_to? :title and (not act_obj.title.nil?)
              act_obj.title.truncate(30, :separator => ' ')
        Severity: Minor
        Found in base/app/helpers/notifications_helper.rb - About 35 mins 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 notify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def notify
            return true unless notificable?
            #Avaible verbs: follow, like, make-friend, post, update, join
        
            case
        Severity: Minor
        Found in base/app/models/activity.rb - About 35 mins 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 find_or_create_for_oauth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def find_or_create_for_oauth(info, signed_in_user = nil)
              auth = Authentication.find_by_provider_and_uid(info["provider"], info["uid"])
        
              if auth.present?
                if signed_in_user.present? && auth.user != signed_in_user
        Severity: Minor
        Found in base/app/models/user.rb - About 35 mins 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_ability_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def create_ability_file
            ability_code = [
              "# Generator social_stream:install has modified this file. Please,",   #0
              "# check everything is working ok, specially if the former `Ability`", #1
              "# class inherited from another class or included another module",     #2
        Severity: Minor
        Found in base/lib/generators/social_stream/base/install_generator.rb - About 35 mins 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 defaults_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def defaults_for(actor)
              subject_type = actor.subject.class.to_s.underscore
        
              cfg_rels = SocialStream.custom_relations.with_indifferent_access[subject_type]
        
        
        Severity: Minor
        Found in base/app/models/relation/custom.rb - About 35 mins 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

        Avoid too many return statements within this function.
        Open

                  return parseWord(subwords[0]) + imageLink + parseWord(subwords[1])
        Severity: Major
        Found in presence/app/assets/javascripts/presence_parser.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return parseWord(subwords[0]) + link + parseWord(subwords[1])
          Severity: Major
          Found in presence/app/assets/javascripts/presence_parser.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return true;
            Severity: Major
            Found in presence/app/assets/javascripts/presence_utilities.js - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                            return ( params[:password] and params[:password] == SocialStream::Presence.xmpp_server_password )
              Severity: Major
              Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return parseWord(subwords[0]) + youtubeLink + parseWord(subwords[1])
                Severity: Major
                Found in presence/app/assets/javascripts/presence_parser.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return word
                  Severity: Major
                  Found in presence/app/assets/javascripts/presence_parser.js - About 30 mins to fix

                    Function Wall has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 find_or_initialize_with_error_by_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def find_or_initialize_with_error_by_email(value, error)
                          if value.present?
                            record = find_by_email(value)
                          end
                          
                    Severity: Minor
                    Found in base/app/models/user.rb - About 25 mins 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 current_subject_from_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def current_subject_from_params
                            return unless params[:s].present?
                    
                            subject = Actor.find_by_slug!(params[:s]).subject
                    
                    
                    Severity: Minor
                    Found in base/lib/social_stream/controllers/helpers.rb - About 25 mins 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    SocialStream.FullCalendar = (function(SS, $, Scheduler, undefined){
                      var callback = new SS.Callback(),
                          current,
                          eventColor = 'gray';
                    
                    
                    Severity: Minor
                    Found in events/app/assets/javascripts/social_stream/fullcalendar.js - About 25 mins 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 recursiveCopyFolder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def recursiveCopyFolder(localPath,remotePath,sftp)
                                
                                #Check if localPath is a file
                                if File.file?(localPath) and File.file?(remotePath)
                                  puts "Copy files..."
                    Severity: Minor
                    Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 25 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language