Method check_state
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def check_state
@check_state = true
if type_name == :import
case status_name
when :uploading
- 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_state
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_state
@check_state = true
if type_name == :import
case status_name
when :uploading
Method post_check_state
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def post_check_state
if type_name == :export
Emailer.send_with_language(:notify_export, user.locale, self.id) if @dispatch_notification
TeamboxData.send_later(:delayed_export, self.id) if @dispatch_export
elsif type_name == :import
- 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_map
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_map
@errors.add "service", "Unknown service #{service}" if !['teambox', 'basecamp'].include?(service)
if type_name == :import and status_name == :mapping
# user needs to be an admin of the target organization
if !user.admin_organizations.map(&:permalink).include?(target_organization)
- 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 do_import
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def do_import
self.processed_at = Time.now
next_status = :imported
begin
- 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"