cloudspokes/cs-website-cms

View on GitHub

Showing 93 of 93 total issues

File challenge.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Challenge < ApiModel
  include Redis::ChallengeSearchable

  attr_accessor :id, :challenge_id, :challenge_type, :attributes,
    :prize_type, :total_prize_money, :top_prize,
Severity: Minor
Found in app/models/challenge.rb - About 2 hrs to fix

    Class Participant has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Participant < ApiModel
      def self.api_endpoint
        "participants"
      end
    
    
    Severity: Minor
    Found in app/models/participant.rb - About 2 hrs to fix

      Method authenticate_account has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        def authenticate_account
      
          ApiModel.access_token = guest_access_token
      
          account = Account.new(User.new(:username => params[:user][:username]))
      Severity: Minor
      Found in app/controllers/users/sessions_controller.rb - About 2 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

      Method authenticate_account has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def authenticate_account
      
          ApiModel.access_token = guest_access_token
      
          account = Account.new(User.new(:username => params[:user][:username]))
      Severity: Major
      Found in app/controllers/users/sessions_controller.rb - About 2 hrs to fix

        Method create has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create
        
            data = {}
            data[:name] = params[:name]
            data[:description] = '<p>Your 
        Severity: Major
        Found in app/controllers/admin/challenges_controller.rb - About 2 hrs to fix

          Method search has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def search
              @title = 'Challenge Search Results'
              search_default_params
          
              gon.adv_search_display = true
          Severity: Minor
          Found in app/controllers/challenges_controller.rb - About 1 hr to fix

            Method process_messages has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                    def process_messages(messages, type)
                        processed_messages = []
                        messages.each do |m|
                            new_message = {}
                            new_message['id'] = m.id
            Severity: Minor
            Found in lib/message_box.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

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

                    }else{
                        $('.tip .arrow').css({left:$(this).position().left-$(this).parents("ul").position().left+50})
                    }
            Severity: Major
            Found in app/assets/javascripts/responsive.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/responsive.js on lines 43..45

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

            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($('.techs').width()==134){
                        $('.tip .arrow').css({top:$(this).position().top-$(this).parents("ul").position().top+40})
                    }else{
            Severity: Major
            Found in app/assets/javascripts/responsive.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/responsive.js on lines 45..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 70.

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

              def create
                # find out how the user is logging in
                login_type = Member.login_type params[:username].downcase
                # if we found a valid user
                if login_type
            Severity: Minor
            Found in app/controllers/users/passwords_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

            Method process_submission has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.process_submission(challenge_id, membername, challenge_submission_id)
            
                # get an admin token for the get requests. fails without an admin token. not sure why.
                admin_access_token = RestforceUtils.access_token(:admin)
            
            
            Severity: Minor
            Found in lib/thurgood.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 update has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def update
            
                # scrub out this crap when nothing submitted in ckeditor -- <p>&Acirc;&#32;</p>\r\n (see http://dev.ckeditor.com/ticket/9732)
                params[:admin_challenge][:description] = nil if params[:admin_challenge][:description].include?('&Acirc;&#32;')
                params[:admin_challenge][:requirements] = nil if params[:admin_challenge][:requirements].include?('&Acirc;&#32;')
            Severity: Minor
            Found in app/controllers/admin/challenges_controller.rb - About 1 hr to fix

              Method advanced_search has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.advanced_search(options)
                  
                  params = Hashie::Mash.new()    
              
                  if options[:platforms]
              Severity: Minor
              Found in app/models/challenge.rb - About 1 hr to fix

                Method getJsConnectString has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def JsConnect.getJsConnectString(user, request = {}, client_id = "", secret = "", secure = true)
                      error = nil
                      
                      timestamp = request["timestamp"].to_i
                      current_timestamp = JsConnect.timestamp
                Severity: Minor
                Found in lib/js_connect.rb - About 1 hr to fix

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

                              nameTmpl: function(item, typeahead) {
                                return $("<span class='challenge'>")
                                  .append("<i class='icon-leaf'>")
                                  .append(typeahead.highlighter(item.name))
                                  .append("&nbsp;(<span class='prizes'>$" + item.total_prize_money + "</span>)")
                  Severity: Major
                  Found in app/assets/javascripts/scripts.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/scripts.js on lines 44..49

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

                  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

                              nameTmpl: function(item, typeahead) {
                                return $("<span class='member'>")
                                  .append("<i class='icon-user'>")
                                  .append(typeahead.highlighter(item.name))
                                  .append("(<span class='wins'>" + item.total_wins + " wins</span>)")
                  Severity: Major
                  Found in app/assets/javascripts/scripts.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/scripts.js on lines 28..33

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

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

                    def self.process_submission(challenge_id, membername, challenge_submission_id)
                  
                      # get an admin token for the get requests. fails without an admin token. not sure why.
                      admin_access_token = RestforceUtils.access_token(:admin)
                  
                  
                  Severity: Minor
                  Found in lib/thurgood.rb - About 1 hr to fix

                    Method payload has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def payload
                        # Get the original challenge to figure out the stuff to be deleted.
                        # We are re-requesting the original challenge instead of tracking which
                        # entries are to be deleted client-side to minimize race conditions. Race
                        # conditions aren't totally eliminated, but the window is largely smaller
                    Severity: Minor
                    Found in app/models/admin/challenge.rb - About 1 hr to fix

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

                          def login_third_party(omniauth, sfdc_account)
                      
                            begin
                      
                              db_authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
                      Severity: Minor
                      Found in app/controllers/authentications_controller.rb - About 1 hr to fix

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

                            def redis_key_for_prize_money(value)
                              if value.is_a?(Hash)
                                min = value[:min].blank? ? 0 : value[:min].to_i
                                max = value[:max].blank? ? 1000000 : value[:max].to_i
                                nest[:temp][{prize_money: value}.hash].tap do |k|
                        Severity: Major
                        Found in lib/redis/challenge_searchable.rb and 1 other location - About 1 hr to fix
                        lib/redis/challenge_searchable.rb on lines 88..97

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

                        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