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,
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]
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
File bootstrap-typeahead.js
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
!
function ($) {
'use strict';
Class ApiModel
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class ApiModel
include ActiveModel::Model
cattr_accessor :access_token
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
- Read upRead up
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']]
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']
- Read upRead up
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>Â </p>\r\n (see http://dev.ckeditor.com/ticket/9732)
params[:admin_challenge][:description] = nil if params[:admin_challenge][:description].include?('Â ')
params[:admin_challenge][:requirements] = nil if params[:admin_challenge][:requirements].include?('Â ')
- Read upRead up
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;
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(){
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]
- Read upRead up
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,
Class Participant
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Participant < ApiModel
def self.api_endpoint
"participants"
end
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]))
- Read upRead up
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
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]))
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
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
- Read upRead up
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
- Read upRead up
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"