ging/social_stream

View on GitHub

Showing 172 of 172 total issues

Method create_ability_file has 32 lines of code (exceeds 25 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 1 hr to fix

    Function Object has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    SocialStream.Object = (function(SS, $, undefined){
      var callback = new SS.Callback(),
          pIcon = '<i class="icon_tool16-private"></i>';
    
    
    
    Severity: Minor
    Found in base/app/assets/javascripts/social_stream/object.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 RelationCustom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    SocialStream.RelationCustom = (function(SS, $, undefined){
      var callback = new SS.Callback();
    
      var getListEl = function() {
        return $('.relation_list');
    Severity: Minor
    Found in base/app/assets/javascripts/social_stream/relation_customs.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 do_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_request(api_url, params, token=nil)
    
          url = URI.parse(@api_url + api_url)
          if not params.empty?
            req = Net::HTTP::Post.new(url.path)
    Severity: Minor
    Found in presence/lib/OpenTok/OpenTokSDK.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 Explore has a Cognitive Complexity of 11 (exceeds 5 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

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

          def method_missing(method, *args, &block)
            super
          rescue NameError => subtype_error
            raise subtype_error unless _delegate_to_supertype?(:method)
    
    
    Severity: Minor
    Found in base/lib/social_stream/models/subtype.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 authenticator has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def authenticator
            Rack::OAuth2::Server::Token.new do |req, res|
              client = Site::Client.find(req.client_id) || req.invalid_client!
              client.secret == req.client_secret || req.invalid_client!
    
    
    Severity: Minor
    Found in oauth2_server/lib/social_stream/oauth2_server/token_endpoint.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 change has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def change
    
        create_table "geotags", :force => true do |t|
          t.integer  "activity_object_id"
          t.integer  "address_id"
    Severity: Minor
    Found in places/db/migrate/20130114184300_create_social_stream_places.rb - About 1 hr to fix

      Method generateRSAKeys has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def generateRSAKeys(keysPath)
                  
                  unless File.directory?(keysPath)
                    return "Keys path not exists"
                  end
      Severity: Minor
      Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 1 hr to fix

        Function Event has 30 lines of code (exceeds 25 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

          Function Repository has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          SocialStream.Repository = (function(SS, $, undefined){
            var callback = new SS.Callback();
          
            var initFilter = function() {
              $('.repository .loading').hide();
          Severity: Minor
          Found in base/app/assets/javascripts/social_stream/repository.js - About 1 hr to fix

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

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

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

            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("http://" + url);
                      var subwords = splitFirst(word,url)
                      return parseWord(subwords[0]) + imageLink + parseWord(subwords[1])
            Severity: Major
            Found in presence/app/assets/javascripts/presence_parser.js and 1 other location - About 1 hr to fix
            presence/app/assets/javascripts/presence_parser.js on lines 113..116

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

            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

                $(document).on("mouseleave", ".unfollow-button", function(){
                  $(this).hide();
                  $(this).siblings(".following-button").show();
                });
            Severity: Major
            Found in base/app/assets/javascripts/social_stream/contact.js and 1 other location - About 1 hr to fix
            base/app/assets/javascripts/social_stream/contact.js on lines 286..289

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

            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

                $(document).on("mouseenter",".following-button", function(){
                  $(this).hide();
                  $(this).siblings(".unfollow-button").show();
                });
            Severity: Major
            Found in base/app/assets/javascripts/social_stream/contact.js and 1 other location - About 1 hr to fix
            base/app/assets/javascripts/social_stream/contact.js on lines 290..293

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

            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 do_request has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def do_request(api_url, params, token=nil)
            
                  url = URI.parse(@api_url + api_url)
                  if not params.empty?
                    req = Net::HTTP::Post.new(url.path)
            Severity: Minor
            Found in presence/lib/OpenTok/OpenTokSDK.rb - About 1 hr to fix

              Function initFullCalendar has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                var initFullCalendar = function() {
                  var calendar = getCalendarEl();
              
                  var options = {
                    header: {
              Severity: Minor
              Found in events/app/assets/javascripts/social_stream/fullcalendar.js - About 1 hr to fix

                Function _setOption has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _setOption: function(option, value) {
                        if(value != null){
                          switch(option) {
                                case "hidden":
                                    if(value) {

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

                  PRESENCE.STORE = (function(P,$,undefined){
                  
                    var init = function(){ }
                      
                      var storePassword = function() {
                  Severity: Minor
                  Found in presence/app/assets/javascripts/presence_store.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

                  Severity
                  Category
                  Status
                  Source
                  Language