Method find_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_for(id,user)
options = hide_conditions !user.is_super_admin?
result = self.find(id,options)
return result unless result
unless result.kind_of?(Array)
- 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 paginate_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.paginate_for(id,user,page,per_page=10)
options = hide_conditions !user.is_super_admin?
result = self.find(id,options)
return result unless result
unless result.kind_of?(Array)
- 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 accessible_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.accessible_to(result,user)
# if no audience is specified then this forum is open to anyone
# if a audience is specified for this forum, am I in the audeience?
if result.audience.nil?
forum = result
- 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 for_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.for_user(user)
user_id = user.class == User ? user.id : user
user = user.class == User ? user : User.find(user)
if user.is_super_admin?
self.scoped
- 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"