botanicus/now-task-manager

View on GitHub
lib/pomodoro/commands/generate.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    unless File.directory?(self.config.today_path_dir)
      command "mkdir #{self.config.today_path_dir}"
    end

Severity: Minor
Found in lib/pomodoro/commands/generate.rb - About 2 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 run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    unless File.directory?(self.config.today_path_dir)
      command "mkdir #{self.config.today_path_dir}"
    end

Severity: Minor
Found in lib/pomodoro/commands/generate.rb - About 1 hr to fix

    Method add_upcoming_events_to_scheduled_list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_upcoming_events_to_scheduled_list(scheduled_task_list)
        upcoming_events = self.config.calendar.select do |event_name, date|
          ((Date.today + 1)..(Date.today + 6)).cover?(date)
        end
    
    
    Severity: Minor
    Found in lib/pomodoro/commands/generate.rb - About 1 hr 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 get_schedule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_schedule(scheduler, **options)
        if schedule_name = options.delete(:schedule)
          schedule = scheduler.schedules.find { |schedule| schedule.name == schedule_name.to_sym }
          unless schedule
            raise t(:no_such_schedule,
    Severity: Minor
    Found in lib/pomodoro/commands/generate.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 populate_from_scheduled_task_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def populate_from_scheduled_task_list(day, scheduled_task_list)
        scheduled_task_list.each do |task_group|
          next unless task_group.scheduled_date == @date
          task_group.tasks.each do |task|
            if task.time_frame
    Severity: Minor
    Found in lib/pomodoro/commands/generate.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 add_postponed_task_to_scheduled_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_postponed_task_to_scheduled_list(scheduled_task_list, time_frame, task)
        return if task.tags.include?(:gen)
    
        # FIXME: Date.today + 1 is wrong if you're running just "now g" without +1,
        # in the morning.
    Severity: Minor
    Found in lib/pomodoro/commands/generate.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