Method export
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.export(options = {format: :text})
header = %w(
username
full_name
full_name_transcription
- 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 export
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.export(options = {format: :text})
header = %w(
username
full_name
full_name_transcription
Method deletable_by?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def deletable_by?(current_user)
return nil unless current_user
if defined?(EnjuCirculation)
# 未返却の資料のあるユーザを削除しようとした
- 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 check_expiration
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_expiration
return if has_role?('Administrator')
if expired_at
if expired_at.beginning_of_day < Time.zone.now.beginning_of_day
- 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 has_role?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def has_role?(role_in_question)
return false unless role
return true if role.name == role_in_question
case role.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"