dgilperez/schedule_attributes

View on GitHub
lib/schedule_attributes/core.rb

Summary

Maintainability
C
1 day
Test Coverage

Method schedule_attributes has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def schedule_attributes
      atts = {}
      time_format = ScheduleAttributes.configuration.time_format
      schedule = read_schedule_field || ScheduleAttributes.default_schedule

Severity: Minor
Found in lib/schedule_attributes/core.rb - About 7 hrs 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 schedule_attributes has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def schedule_attributes
      atts = {}
      time_format = ScheduleAttributes.configuration.time_format
      schedule = read_schedule_field || ScheduleAttributes.default_schedule

Severity: Major
Found in lib/schedule_attributes/core.rb - About 2 hrs to fix

    Method schedule_attributes= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def schedule_attributes=(options)
          raise ArgumentError "expecting a Hash" unless options.is_a? Hash
    
          options = options.with_indifferent_access
          merge_date_and_time_into_time_attribute!(options)
    Severity: Minor
    Found in lib/schedule_attributes/core.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