From: Michel Demazure Date: 2010-08-25T01:07:34+09:00 Subject: Re: Static code analysis in Ruby 1.9 Hubert Lepicki wrote: > > I am wondering if I can perform 1.9 code analysis with other tools? If > not, maybe I can convert 1.9 code to 1.8 code in some automatic way? > > Thanks, > Hubert For quite a long time now, I have been using all the 1.8 tools (flog, flay, reek, ...) after filtering the 1.9 files thru the following ad hoc rake tast desc "copy in flog_temp with 1.8 hash syntax, ascii characters and unix end_of_line" task :convert do flog_temp = File.join(SRC, 'flog_temp') Dir.chdir(flog_temp) Dir.glob('**/*.rb') { |name| File.delete(name) } Dir.chdir(SRC) list = Dir.glob('lib/**/*.rb') list.each do |name| arr = IO.readlines(File.join(SRC, name)) File.open(File.join(flog_temp, name), "wb:utf-8") do |f| arr.each do |line| line.gsub!(/:(nodoc|startdoc|stopdoc):/, "") line.gsub!(/(\w+):\s+/, ':\1 => ') line.gsub!(/[éèàêîôùïöüë]/, "_") f.print line end end end end HTH, _md -- Posted via http://www.ruby-forum.com/.