ging/social_stream

View on GitHub

Showing 172 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          uiChatboxTitlebarVideoChange = (self.uiChatboxTitlebarVideoChange = $('<a href="#"></a>'))
          .addClass('ui-corner-all ' + 
            'ui-chatbox-icon' + ' ui-videobox-icon-change'
           )
          .attr('role', 'button')
    presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js on lines 178..189

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 125.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                uiChatboxTitlebarVideo = (self.uiChatboxTitlebarVideo = $('<a href="#"></a>'))
          .addClass('ui-corner-all ' + 
            'ui-chatbox-icon' + ' ui-videobox-icon'
           )
          .attr('role', 'button')
    presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js on lines 197..208

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 125.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    uiChatboxTitlebarClose = (self.uiChatboxTitlebarClose = $('<a href="#"></a>'))
                    .addClass('ui-corner-all ' +
                          'ui-chatbox-icon '
                         )
                    .attr('role', 'button')
            presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js on lines 155..171

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 94.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    uiChatboxTitlebarMinimize = (self.uiChatboxTitlebarMinimize = $('<a href="#"></a>'))
                    .addClass('ui-corner-all ' + 
                          'ui-chatbox-icon'
                         )
                    .attr('role', 'button')
            presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js on lines 133..150

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 94.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          SocialStream.Search = (function(SS, $, undefined){
                            var callback = new SS.Callback();
                          
                            var initPagination = function() {
                              SS.Pagination.show();
                          Severity: Major
                          Found in base/app/assets/javascripts/social_stream/search.js and 1 other location - About 2 hrs to fix
                          base/app/assets/javascripts/social_stream/conversation.js on lines 11..22

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 87.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          SocialStream.Conversation = (function(SS, $, undefined) {
                            var callback = new SS.Callback();
                          
                            var initPagination = function() {
                              SS.Pagination.show();
                          Severity: Major
                          Found in base/app/assets/javascripts/social_stream/conversation.js and 1 other location - About 2 hrs to fix
                          base/app/assets/javascripts/social_stream/search.js on lines 5..17

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 87.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language