northworld/google_calendar

View on GitHub
lib/google/calendar.rb

Summary

Maintainability
B
5 hrs
Test Coverage
A
97%

Class Calendar has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Calendar

    attr_reader :id, :connection, :summary, :location, :description, :time_zone

    #
Severity: Minor
Found in lib/google/calendar.rb - About 4 hrs to fix

    Method parse_extended_properties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    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("&")
    Severity: Minor
    Found in lib/google/calendar.rb - About 45 mins to fix

    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

        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?
    Severity: Minor
    Found in lib/google/calendar.rb - About 35 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status