Created
February 26, 2017 19:41
-
-
Save thedjinn/17c68d1e62b5594581625c016b00e42a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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