lib/google/calendar.rb
Class Calendar
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Calendar
attr_reader :id, :connection, :summary, :location, :description, :time_zone
#
Method parse_extended_properties
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_extended_properties(extended_properties) # :nodoc
query_parts = []
['shared', 'private'].each do |prop_type|
next unless extended_properties[prop_type]
query_parts << extended_properties[prop_type].map {|key, value| (prop_type == "shared" ? "sharedExtendedProperty=" : "privateExtendedProperty=") + "#{key}%3D#{value}" }.join("&")
- 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 save_event
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def save_event(event)
method = event.new_event? ? :post : :put
body = event.use_quickadd? ? nil : event.to_json
notifications = "sendNotifications=#{event.send_notifications?}"
query_string = if event.use_quickadd?
- 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"