Showing 9 of 572 total issues
Class AdminsController
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class AdminsController < ApplicationController
skip_before_filter :authenticate, :only => ['new', 'create']
before_filter :validate_admin, :set_admin, :except => ['new', 'create']
def new
Consider simplifying this complex logical expression. Open
if (time.month == 5 or time.month == 6 or (time.month == 4 and time.day >= 15) or (time.month == 7 and time.day <= 15) or
(time.month == 10 and time.day >= 15) or (time.month == 11 and time.day <= 15))
puts "Sending Emails to Admins..."
AdminMailer.send_look_at_submission
puts "done."
Method delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def delete
if @admin.superadmin == true
c = 0
for a in Admin.all
if params.has_key? "delete_#{a.name}"
- 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 skills_str
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def skills_str
if talents.nil? || talents.length.zero?
return ''
end
skills = []
- 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
Consider simplifying this complex logical expression. Open
if ((time.month == 7 and time.day > 15) or (time.month == 8 and time.day <= 15) or
(time.month == 11 and time.day > 15) or time.month == 12)
puts "Sending Emails to Admins..."
AdminMailer.send_look_at_submission
puts "done."
Method create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
oauth_hash = Rails.env.test? ? OmniAuth.config.mock_auth[:google] : env["omniauth.auth"]
user = User.user_from_oauth(oauth_hash)
admin = Admin.admin_from_oauth(oauth_hash)
session[:user_email] = oauth_hash[:info][:email]
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
@user = User.find_by_id(session[:user_id])
@team = Team.find_by_id(@user.team.id)
d1 = submission_params[:disc1id]
- 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
Consider simplifying this complex logical expression. Open
if ((time.month == 8 and time.day > 15) or time.month == 9 or
time.month == 1 or (time.month == 2 and time.day <= 20))
puts "Sending Emails to Admins..."
AdminMailer.send_look_at_submission
puts "done."
Avoid too many return
statements within this method. Open
return Team.all.each