Skip to content

Instantly share code, notes, and snippets.

@thedjinn
Created February 26, 2017 19:41
Show Gist options
  • Save thedjinn/17c68d1e62b5594581625c016b00e42a to your computer and use it in GitHub Desktop.
Save thedjinn/17c68d1e62b5594581625c016b00e42a to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "term/ansicolor"
include Term::ANSIColor
EXTENSIONS = ["swift", "m", "mm", "c", "cpp", "h", "hpp", "rb", "py", "js", "css", "coffee"]
filename_printed = false
Dir["**/*"].each do |filename|
extension = File.extname(filename)[1..-1]
next unless EXTENSIONS.include? extension
if filename_printed
puts
end
filename_printed = false
File.readlines(filename).each_with_index do |line, index|
if line =~ /TODO|XXX|FIXME/
unless filename_printed
parts = filename.split("/")
if parts.count > 1
puts "#{green}#{parts[0..-2].join("/")}/#{bold}#{parts[-1]}#{reset}"
else
puts "#{green}#{bold}#{filename}#{reset}"
end
filename_printed = true
end
line = line.strip.gsub(/TODO|XXX|FIXME/, "#{red}#{bold}\\0#{reset}")
puts "#{yellow}#{bold}#{index}#{reset}: #{line}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment