From: David Unric Date: 2010-11-10T06:00:40+09:00 Subject: Re: Analyzer for errors in code ? Robert Klemme wrote in post #960402: >> >> puts mymsg >> else >> puts 'Nope' >> end >> end >> >> >> How to avoid such pitfalls with writing more complex ruby code ? I can't >> believe there is no other way how to verify the code without 'waiting >> for exception at proper conditions' and then solve the bug. > > Well, actually you would catch the bug during testing which you have to > do anyway. If you don't catch it during testing you have bad test > coverage. :-) > > The problem with this is that "mymsg" might be a method call or a local > variable read. Ruby recognizes local variables (via assignment) so it > knows that "my_msg" is a local variable. But there is no easy way I am > aware of to reliably detect that "mymsg" is a typo from "my_msg". ;aybe > one could do some fuzzy pattern matching. > > Kind regards > > robert I see but such lint tool would parse whole source and included modules and just warn if didn't find an asignment in the scope it's used in. In the above case it wouldn't find any mymsg variable assignment or function/method definiton and warn me about it. -- Posted via http://www.ruby-forum.com/.