ging/social_stream

View on GitHub

Showing 172 of 172 total issues

Method destroy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy

    @conversation.move_to_trash(@actor)

    respond_to do |format|
Severity: Minor
Found in base/app/controllers/conversations_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 SiteClient has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

SocialStream.SiteClient = (function(SS, $, undefined) {
  var callback = new SS.Callback();

  var initNewModal = function() {
    $('.new_site_client-modal-link').attr('href', '#new_site_client-modal');
Severity: Minor
Found in oauth2_server/app/assets/javascripts/social_stream/site_client.js - About 1 hr to fix

    Function buildYoutubeVideoLink has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function buildYoutubeVideoLink(url){
          //Get youtube video id
          var youtube_video_id=url.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0];
          var youtube_api_url = "http://gdata.youtube.com/feeds/api/videos/" + youtube_video_id
        
    Severity: Minor
    Found in presence/app/assets/javascripts/presence_parser.js - About 1 hr to fix

      Function loadPermissionList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var loadPermissionList = function(el) {
          var radioInput = $(el);
          var relVal = radioInput.val();
      
          $('#permissions').find('.postit').hide();
      Severity: Minor
      Found in base/app/assets/javascripts/social_stream/relation_customs.js - About 1 hr to fix

        Method authorization has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def authorization(params)
                    case SocialStream::Presence.secure_rest_api
                    when true
                      #Authorization using asymmetric RSA keys
                      begin
        Severity: Minor
        Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 1 hr to fix

          Function Profile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          SocialStream.Profile = (function(SS, $, undefined){
            var callback = new SS.Callback();
          
            var initEditButtons = function(options) {
              $("#profile-info .update").filter(function(i, el) {
          Severity: Minor
          Found in base/app/assets/javascripts/social_stream/profile.js - About 1 hr to fix

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

                var showVideoChatNotificationForSlugClientIssue = function(slug){
                  var msg = I18n.t("chat.notify.videochat.clientIssue", {name: PRESENCE.XMPPClient.getNameFromSlug(slug)});
                  showVideoChatNotificationForSlug(slug,msg);
                }
            Severity: Major
            Found in presence/app/assets/javascripts/presence_notifications.js and 1 other location - About 1 hr to fix
            presence/app/assets/javascripts/presence_notifications.js on lines 44..47

            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 55.

            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

                var showVideoChatNotificationForSlugClientOffline = function(slug){
                  var msg = I18n.t("chat.notify.videochat.offline", {name: PRESENCE.XMPPClient.getNameFromSlug(slug)});
                  showVideoChatNotificationForSlug(slug,msg);
                }
            Severity: Major
            Found in presence/app/assets/javascripts/presence_notifications.js and 1 other location - About 1 hr to fix
            presence/app/assets/javascripts/presence_notifications.js on lines 39..42

            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 55.

            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

                      case "image":
                        var imageLink = buildImageLink(url);
                        var subwords = splitFirst(word,url)
                        return parseWord(subwords[0]) + imageLink + parseWord(subwords[1])
            Severity: Minor
            Found in presence/app/assets/javascripts/presence_parser.js and 1 other location - About 55 mins to fix
            presence/app/assets/javascripts/presence_parser.js on lines 88..91

            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 54.

            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

                      case "video-youtube":
                        var youtubeLink =  buildYoutubeVideoLink(url);
                        var subwords = splitFirst(word,url)
                        return parseWord(subwords[0]) + youtubeLink + parseWord(subwords[1])
            Severity: Minor
            Found in presence/app/assets/javascripts/presence_parser.js and 1 other location - About 55 mins to fix
            presence/app/assets/javascripts/presence_parser.js on lines 84..87

            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 54.

            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 models has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def models(search_type, key = nil)
                    case search_type
                    when :quick
                      quick_search_models
                    when :extended
            Severity: Minor
            Found in base/lib/social_stream/search.rb - About 55 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 fill has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def fill linkser_object
                self.title = linkser_object.title if linkser_object.title
                self.description = linkser_object.description if linkser_object.description
                self.url = linkser_object.last_url
                r = linkser_object.resource
            Severity: Minor
            Found in linkser/app/models/link.rb - About 55 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 contact_actors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def contact_actors(options = {})
                subject_types   = Array(options[:type] || self.class.subtypes)
                subject_classes = subject_types.map{ |s| s.to_s.classify }
                
                as = Actor.select('actors.*').
            Severity: Minor
            Found in base/app/models/actor.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(subject)
                    
                    #Download alias action
                    alias_action :download, :to => :read
                    alias_action :original, :to => :read
            Severity: Minor
            Found in base/lib/social_stream/base/ability.rb - About 55 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 Action has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            SocialStream.Events.Action = (function(SS, $, undefined){
              var animateCalendar = function(action) {
                if (action.activity_object.type != "Event") {
                  return;
                }
            Severity: Minor
            Found in events/app/assets/javascripts/social_stream/events.action.js - About 55 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 authorize_endpoint has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def authorize_endpoint(allow_approval = false)
                Rack::OAuth2::Server::Authorize.new do |req, res|
                  @client = Site::Client.find(req.client_id) || req.bad_request!
            
                  res.redirect_uri = @redirect_uri = req.verify_redirect_uri!(@client.callback_url)
            Severity: Minor
            Found in oauth2_server/app/controllers/authorizations_controller.rb - About 55 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

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

                    { type: Mime::WEBM.to_s, src: options[:helper].polymorphic_url(self, format: :webm) },
                    { type: Mime::MP4.to_s,  src: options[:helper].polymorphic_url(self, format: :mp4) },
                    { type: Mime::FLV.to_s,  src: options[:helper].polymorphic_url(self, format: :flv) }
            Severity: Minor
            Found in documents/app/models/video.rb and 1 other location - About 50 mins to fix
            documents/app/models/audio.rb on lines 27..29

            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 43.

            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

                    { type: Mime::MP3.to_s, src: options[:helper].polymorphic_url(self, format: :mp3) },
                    { type: Mime::WAV.to_s,  src: options[:helper].polymorphic_url(self, format: :wav) },
                    { type: Mime::WEBMA.to_s,  src: options[:helper].polymorphic_url(self, format: :webma) }
            Severity: Minor
            Found in documents/app/models/audio.rb and 1 other location - About 50 mins to fix
            documents/app/models/video.rb on lines 28..30

            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 43.

            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

                  if (visibleMinSlugs.length > 0) {
                    sessionStorage.setItem("slugs_with_visible_min_chatbox", visibleMinSlugs.join(","));
                  } else {
                    sessionStorage.setItem("slugs_with_visible_min_chatbox", null);
                  }
            Severity: Minor
            Found in presence/app/assets/javascripts/presence_persistence.js and 1 other location - About 50 mins to fix
            presence/app/assets/javascripts/presence_persistence.js on lines 77..81

            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 51.

            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

                  if (visibleMaxSlugs.length > 0) {
                    sessionStorage.setItem("slugs_with_visible_max_chatbox", visibleMaxSlugs.join(","));
                  } else {
                    sessionStorage.setItem("slugs_with_visible_max_chatbox", null);
                  }
            Severity: Minor
            Found in presence/app/assets/javascripts/presence_persistence.js and 1 other location - About 50 mins to fix
            presence/app/assets/javascripts/presence_persistence.js on lines 83..87

            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 51.

            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