Showing 15 of 767 total issues
Method select_contacts
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def select_contacts
user = User.where(:id => session[:id]).take
if user
@receiver_all = []
@receiver_name_all = []
- 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
File event_controller.rb
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
class EventController < ApplicationController
attr_accessor :latlng
attr_accessor :formatted_address
#attr_accessor :latitud
#attr_accessor :longitud
Method toDurationString
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def self.toDurationString(duration_setting)
if duration_setting == 'arrive'
return "Until I Arrive"
elsif duration_setting[-4..-1] == 'hour' or duration_setting[-5..-1] == 'hours'
if duration_setting[1] == ' '
- 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 select_contacts
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_contacts
user = User.where(:id => session[:id]).take
if user
@receiver_all = []
@receiver_name_all = []
Method user_map
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def user_map
def parseDurationToCheckCondition(d)
# return true if condition is met and stop tracking, else return false if keep tracking
if d == 'arrive'
Method send_mail
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_mail
gmail = Gmail.new('woofwhere', 'battle431101')
if session[:id]
user = User.find_by id: session[:id]
if user
Method toDurationString
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.toDurationString(duration_setting)
if duration_setting == 'arrive'
return "Until I Arrive"
elsif duration_setting[-4..-1] == 'hour' or duration_setting[-5..-1] == 'hours'
if duration_setting[1] == ' '
Method user_map
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def user_map
def parseDurationToCheckCondition(d)
# return true if condition is met and stop tracking, else return false if keep tracking
if d == 'arrive'
- 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 summary
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def summary
def parseDuration(d)
if d
if d == 'arrive'
Method store_duration
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def store_duration
logger.debug params.inspect
if params[:arrive]
@duration = 'arrive'
elsif params[:until_this_time] != '0'
- 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 send_mail
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_mail
gmail = Gmail.new('woofwhere', 'battle431101')
if session[:id]
user = User.find_by id: session[:id]
if user
- 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 parseDurationToCheckCondition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parseDurationToCheckCondition(d)
# return true if condition is met and stop tracking, else return false if keep tracking
if d == 'arrive'
# print "\n Inside d=='arrive' \n"
# print @event.current_lat, @event.current_lng
- 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 parseDuration
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parseDuration(d)
if d
if d == 'arrive'
return 'Until I arrive'
elsif d[d.size-1] == 'm'
- 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 summary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def summary
def parseDuration(d)
if d
if d == 'arrive'
- 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
Avoid too many return
statements within this method. Open
return nil