about summary refs log tree commit diff
path: root/code2ny
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-12-23 17:58:52 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-12-23 17:58:52 +0100
commit29478965e00964b97d30a121634b40b0d7c4a30c (patch)
tree034ce00c60abd549d3f4e49d254de08a97775adb /code2ny
parentd11875b669f27566be0d0d61875b388f5a8bdc37 (diff)
downloadnotyet-29478965e00964b97d30a121634b40b0d7c4a30c.tar.gz
notyet-29478965e00964b97d30a121634b40b0d7c4a30c.tar.xz
notyet-29478965e00964b97d30a121634b40b0d7c4a30c.zip
add code2ny
Diffstat (limited to 'code2ny')
-rwxr-xr-xcode2ny28
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