Gavin Kistner wrote: > If you personally find that you are having trouble in this arena, I > suspect that it wouldn't be hard to write a code analyzer that alerted > on potential misspellings. Here's a simple example I just came up with. (If this were to be taken a little further, it should probably report line numbers. If it were to be taken a lot further, it should probably use actual parsing of Ruby code to determine class scope for variables, leave out things that look like variables inside strings/regexp/comments, etc.) require 'typochecker' class Foo def foo @@name = 'boot' @name = 'wow' @somethingDelicious = 12 end def whee print( @mane, @@names ) print( @somethingDelicions ) end end #=> Possible typo: @@name versus @@names #=> Possible typo: @name versus @mane #=> Possible typo: @somethingDelicious versus @somethingDelicions (typochecker.rb) # http://po-ru.com/files/levenshtein/1.3/levenshtein.rb require 'levenshtein' source = IO.read( $0 ) cvars, ivars = source.scan( /@{1,2}\w+/ ).partition{ |v| /^@@/ =~ v } [ cvars, ivars ].each{ |vars| vars.each_with_index{ |v1, i| vars[ (i+1)..-1 ].each{ |v2| if Levenshtein.distance( v1, v2 ) <= 2 warn "Possible typo: #{v1} versus #{v2}" end } } }