cloudspokes/cs-website-cms

View on GitHub

Showing 56 of 93 total issues

Class Challenge has 44 methods (exceeds 20 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 6 hrs to fix

    Class ChallengesController has 41 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ChallengesController < ApplicationController
    
      before_filter :authenticate_user!, :only => [:preview, :preview_survey, :review, :register, 
        :watch, :agree_tos, :submission, :submissions, :submission_view_only, :comment, 
        :submit, :submit_details, :participant_submissions, :results_scorecard, :appeals]
    Severity: Minor
    Found in app/controllers/challenges_controller.rb - About 5 hrs to fix

      File challenges_controller.rb has 372 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'will_paginate/array'
      require 'digest/sha1'
      
      class ChallengesController < ApplicationController
      
      
      Severity: Minor
      Found in app/controllers/challenges_controller.rb - About 4 hrs to fix

        File bootstrap-typeahead.js has 318 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        
        !
        function ($) {
        
          'use strict';
        Severity: Minor
        Found in app/assets/javascripts/bootstrap-typeahead.js - About 3 hrs to fix

          Class ApiModel has 28 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApiModel
            include ActiveModel::Model
          
            cattr_accessor :access_token  
          
          
          Severity: Minor
          Found in app/models/api_model.rb - About 3 hrs to fix

            Method getJsConnectString has a Cognitive Complexity of 23 (exceeds 5 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 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

            Class Challenge has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Admin::Challenge
              include ActiveModel::Model
            
              STATUSES = [['Draft', 'Draft'] ,['Open for Submissions', 'Open for Submissions'] ,['Hidden', 'Hidden']]
            
            
            Severity: Minor
            Found in app/models/admin/challenge.rb - About 3 hrs to fix

              Method initialize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(params={})
                  # there has GOT to be some better way to clean this up ...
                  params['categories'] = params.delete('challenge_categories__r') if params['challenge_categories__r']
                  params['platforms'] = params.delete('challenge_platforms__r') if params['challenge_platforms__r']
                  params['technologies'] = params.delete('challenge_technologies__r') if params['challenge_technologies__r']
              Severity: Minor
              Found in app/models/challenge.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 update has a Cognitive Complexity of 20 (exceeds 5 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 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

              Function startWheel has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function startWheel() {
                      $('.spinner-wrap .spin-btn').addClass("disabled");        
              
                      var group = $(".spinner .group");
                      var time = 0;
              Severity: Major
              Found in app/assets/javascripts/mashathon/script.js - About 2 hrs to fix

                File script.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                 * SuperAwesome Cloud API Mashathon Virtual Spinner JavaScript file
                 */
                
                $(document).ready(function(){
                Severity: Minor
                Found in app/assets/javascripts/mashathon/script.js - About 2 hrs to fix

                  Method advanced_search has a Cognitive Complexity of 17 (exceeds 5 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 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

                  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 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 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 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 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_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

                            Severity
                            Category
                            Status
                            Source
                            Language