def parsef!(file: "")
      types = @type ? [@type] : VALID_TASKS

      File.open(file, "r") do |f|
        line_number = 1
        while line = f.gets
          types.each do |type|
            result = line.match(/#{Regexp.escape(type)}[\s,:-]+(\S.*)\Z/) rescue nil

            unless result.nil?
              task = {
                file: file,
                line_number: line_number,
                task: result.to_a.last
              }

              @tasks[type.to_sym] << task
            end
          end

          line_number += 1
        end
      end
    end
def parsef!(file: "")
      types = @type ? [@type] : VALID_TASKS

      File.open(file, "r") do |f|
        line_number = 1
        while line = f.gets
          types.each do |type|
            result = line.match(/#{Regexp.escape(type)}[\s,:-]+(\S.*)\Z/) rescue nil

            unless result.nil?
              task = {
                file: file,
                line_number: line_number,
                task: result.to_a.last
              }

              @tasks[type.to_sym] << task
            end
          end

          line_number += 1
        end
      end
    end
Parse a file to find tasks