Skip to content

Instantly share code, notes, and snippets.

@phdoerfler
Created December 4, 2020 12:30
Show Gist options
  • Save phdoerfler/8e36bdda5241bb28cf94cbeb09693659 to your computer and use it in GitHub Desktop.
Save phdoerfler/8e36bdda5241bb28cf94cbeb09693659 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# encoding: utf-8
$stdout.sync = true
print "Scanning for FIXMEs. Generating diff…"
diff_bad = `HGRCPATH="" hg diff -r "default:$HG_NODE" --exclude 'glob:**.xml' --ignore-space-change --nodates --noprefix`
print "\rParsing and preparing output… "
diff = diff_bad.encode('utf-8', 'binary', :invalid => :replace, :undef => :replace) # because .properties files
lines = diff.split("\n")
adds = lines.grep(/^\+/)
fixme_lines = adds.grep(/FIXME/)
texts = fixme_lines.map do |l| l.match /FIXME\s+(?<text>.*)/ end
print "\r \r"
puts "Number of FIXMEs left: #{fixme_lines.size}"
texts.each do |m|
puts "\e[1m\e[31mFIXME\e[0m\e[22m #{m[:text]}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment