diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-12-23 17:58:52 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-12-23 17:58:52 +0100 |
commit | 29478965e00964b97d30a121634b40b0d7c4a30c (patch) | |
tree | 034ce00c60abd549d3f4e49d254de08a97775adb | |
parent | d11875b669f27566be0d0d61875b388f5a8bdc37 (diff) | |
download | notyet-29478965e00964b97d30a121634b40b0d7c4a30c.tar.gz notyet-29478965e00964b97d30a121634b40b0d7c4a30c.tar.xz notyet-29478965e00964b97d30a121634b40b0d7c4a30c.zip |
add code2ny
-rwxr-xr-x | code2ny | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/code2ny b/code2ny new file mode 100755 index 0000000..ed1752c --- /dev/null +++ b/code2ny @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby +# code2ny - convert fixme markers in source code to notyet todo lists + +KEYWORDS = %w[todo hack xxx fixme bug] + +kw = /\b#{Regexp.union(KEYWORDS.map(&:upcase))}\b.*/ + +single = ARGV.size <= 1 + +fn = nil +while line = gets + if line =~ kw + msg = $& + msg.gsub!(/\s*\*\/.*/, '') if line =~ /\/\*/ + + if single + puts "#{ARGF.filename}:#{ARGF.file.lineno}\t" \ + "- #{File.basename(ARGF.filename)}:#{msg}" + else + if ARGF.filename != fn + fn = ARGF.filename + puts "#{fn}:1\t- #{fn}:" + end + + puts "#{fn}:#{ARGF.file.lineno}\t - #{msg}" + end + end +end |