botanicus/now-task-manager

View on GitHub

Showing 21 of 34 total issues

Method main has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def self.main(today_tasks, task_list)
    if today_tasks && current_time_frame = today_tasks.current_time_frame
      colour, icon = self.heading(current_time_frame, today_tasks.active_task)
      puts icon, '---'
      self.with_active_time_frame(current_time_frame)
Severity: Minor
Found in lib/pomodoro/commands/bitbar.rb - About 3 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 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 main has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.main(today_tasks, task_list)
    if today_tasks && current_time_frame = today_tasks.current_time_frame
      colour, icon = self.heading(current_time_frame, today_tasks.active_task)
      puts icon, '---'
      self.with_active_time_frame(current_time_frame)
Severity: Minor
Found in lib/pomodoro/commands/bitbar.rb - About 1 hr to fix

    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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          ensure_today
      
          unless (@args & ['--confirm', '-c']).empty?
            Pomodoro::Commands::Next.new(Array.new).run
      Severity: Minor
      Found in lib/pomodoro/commands/start.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 calendar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def calendar
            (self.data['calendar'] || Hash.new).reduce(Hash.new) do |buffer, (event_name, date)|
              if date.is_a?(Integer)
                today = Date.today
                p_date = Date.new(today.year, today.month, date)
      Severity: Minor
      Found in lib/pomodoro/config.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 with_active_time_frame has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.with_active_time_frame(current_time_frame)
          puts "#{current_time_frame.header} | color=green"
          puts "#{current_time_frame.remaining_duration}h remaining"
      
          current_time_frame.tasks.each do |task|
      Severity: Minor
      Found in lib/pomodoro/commands/bitbar.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 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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          ensure_today
          today_list = parse_today_list(self.config).task_list
      
          active_task = today_list.active_task
      Severity: Minor
      Found in lib/pomodoro/commands/active.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_period_and_date has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_period_and_date(default_period = :day)
              increment = self.get_date_increment
              period = (@args.first && @args.shift || default_period).to_sym
      
              if increment == 0
      Severity: Minor
      Found in lib/pomodoro/commands.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 run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def run
          ensure_today
      
          unless (@args & ['--confirm', '-c']).empty?
            Pomodoro::Commands::Next.new(Array.new).run
      Severity: Minor
      Found in lib/pomodoro/commands/start.rb - About 1 hr to fix

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

          def run
            period, date = self.get_period_and_date(:week)
            router = Pomodoro::Router.new(self.config.data_root_path, date)
        
            if router.respond_to?(:"#{period}_plan_path")
        Severity: Minor
        Found in lib/pomodoro/commands/plan.rb - About 55 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 format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.format(task)
              output = [task.class::STATUS_MAPPING[task.status][0]]
              if task.start_time || task.end_time
                output << "[#{self.format_duration(task.start_time, task.end_time)}]"
              end
        Severity: Minor
        Found in lib/pomodoro/formats/today/task/formatter.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 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def run
            @args.unshift(Date.today.year.to_s) unless @args.first&.match(/^\d{4}$/)
        
            year = @args.shift
        
        
        Severity: Minor
        Found in lib/pomodoro/commands/test.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def run
            period, date = self.get_period_and_date(:day)
            router = Pomodoro::Router.new(self.config.data_root_path, date)
        
            abort t(:cannot_be_past_today) if date > Date.today
        Severity: Minor
        Found in lib/pomodoro/commands/review.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

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

            def status_x
              if self.unstarted? then :unstarted
              # elsif self.skipped? then :skipped
              # elsif self.ended? then :ended
              elsif self.in_progress? then :in_progress
        Severity: Minor
        Found in lib/pomodoro/formats/today/task/statuses.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

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

            def duration
              self.with_prev_and_next.reduce(0) do |sum, (prev_time_frame, time_frame, next_time_frame)|
                prev_time_frame_end_time   = prev_time_frame ? prev_time_frame.end_time   : Hour.parse('0:00')
                next_time_frame_start_time = next_time_frame ? next_time_frame.start_time : Hour.parse('23:59')
                time_frame.duration(prev_time_frame_end_time, next_time_frame_start_time) + sum
        Severity: Minor
        Found in lib/pomodoro/formats/today/task_list.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

        Severity
        Category
        Status
        Source
        Language