Rake task for displaying TODO/FIXME notes.

This commit is contained in:
Yorick Peterse 2014-07-22 16:38:05 +02:00
parent 05cf07755d
commit 713d8a092b
1 changed files with 25 additions and 0 deletions

25
task/todo.rake Normal file
View File

@ -0,0 +1,25 @@
desc 'Extracts TODO tags and the likes'
task :todo do
pattern = /(NOTE|FIXME|TODO|THINK|@todo)(.+)/
found = Hash.new { |hash, key| hash[key] = [] }
Dir.glob('lib/**/*.{rb,rl,y}').each do |file|
File.open(file, 'r') do |handle|
handle.each_line.each_with_index do |line, index|
if line =~ pattern
found[file] << [index + 1, $1 + $2]
end
end
end
end
found.each do |file, notes|
puts file
notes.each do |(nr, line)|
puts "#{nr}: #{line}"
end
puts
end
end