Showing 10 of 33 total issues
Method code
has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring. Open
def self.code
Proc.new do |navigation|
navigation.items do |primary|
primary.dom_class = 'nav'
- 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 up
has 165 lines of code (exceeds 25 allowed). Consider refactoring. Open
def up
MongoDatabaseCleaner.clean
create_table :users do |t|
t.string :name
Method code
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.code
Proc.new do |navigation|
navigation.items do |primary|
primary.dom_class = 'nav'
Method path_to
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def path_to(page_name)
case page_name
when /^the home\s?page$/
'/'
File schema.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
ActiveRecord::Schema.define(version: 20150819152545) do
create_table "areas", force: :cascade do |t|
t.string "ancestry", limit: 255
t.integer "ancestry_depth", limit: 4, default: 0
Method down
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def down
unless (Product::Recruiting rescue nil)
create_table 'vacancies', force: true do |t|
t.string 'type'
t.integer 'project_id'
Consider simplifying this complex logical expression. Open
if user.present?
ability.can(:restful_actions, Scholarship::Team) {|team| team.new_record? || user.is_leader_of_scholarship_team?(team) }
ability.can(:restful_actions, Scholarship::TeamMembership) do |membership|
membership.new_record? || membership.user_id == user.id || user.is_leader_of_scholarship_team?(membership.team)
Method accepted_team_membership_for_team_roles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def accepted_team_membership_for_team_roles
team_roles = roles.select{|role| TeamMembership::ROLES.include?(role) }
return unless team_roles.any?
- 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 up
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def up
Product.each do |product|
next if product.klass_name.present?
if product.name == 'Product'
- 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 find_program
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_program
@program = case action_name
when 'new' then
@organization = Organization.friendly.find(params[:organization_id]) if params[:organization_id].present?
@organization.present? ? @organization.scholarship_programs.new : Scholarship::Program.new
- 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"