dgilperez/schedule_attributes

View on GitHub
lib/schedule_attributes/input.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class Input has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Input

    module RepeatingDates
      def repeat?; true end

Severity: Minor
Found in lib/schedule_attributes/input.rb - About 3 hrs to fix

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

        def end_time_date
          return date_input unless @params[:start_time].present?
          return nil if @params[:all_day]
          return nil unless @params[:end_time].present?
          parse_date_time(date_input, @params[:end_time]) <= start_time ? (Time.parse(date_input) + 1.day).strftime('%Y-%m-%d') : date_input
    Severity: Minor
    Found in lib/schedule_attributes/input.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

    Method end_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def end_date
          if @params[:end_date]
            parse_date_time(@params[:end_date], @params[:end_time] || @params[:start_time])
          elsif @params[:end_time] && !time_only?(@params[:end_time])
            parse_date_time(@params[:end_time])
    Severity: Minor
    Found in lib/schedule_attributes/input.rb - About 25 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