Class Person
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
class Person < ActiveRecord::Base
include Seek::Rdf::RdfGeneration
include Seek::Taggable
include Seek::AdminDefinedRoles
File person.rb
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'grouped_pagination'
class Person < ActiveRecord::Base
include Seek::Rdf::RdfGeneration
Method validates_associated
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validates_associated(*associations)
associations.each do |association|
class_eval do
validates_each(associations) do |record, associate_name, value|
associates = record.send(associate_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 people_i_may_know
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def people_i_may_know
res=[]
institutions.each do |i|
i.people.each do |p|
res << p unless p==self or res.include? p
- 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 get_all_as_json
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.get_all_as_json
all_people = Person.order("ID asc")
names_emails = all_people.collect{ |p| {"id" => p.id,
"name" => (p.first_name.blank? ? (logger.error("\n----\nUNEXPECTED DATA: person id = #{p.id} doesn't have a first name\n----\n"); "(NO FIRST NAME)") : h(p.first_name)) + " " +
(p.last_name.blank? ? (logger.error("\n----\nUNEXPECTED DATA: person id = #{p.id} doesn't have a last name\n----\n"); "(NO LAST NAME)") : h(p.last_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 clean_up_and_assign_permissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def clean_up_and_assign_permissions
#remove the permissions which are set on this person
remove_permissions
#retrieve the items that this person is contributor (owner for assay)
- 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"