[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Lint for Ruby

Matt Mower

10/25/2004 6:10:00 PM

Hi folks.

I was wondering whether anyone had done any work on a Lint style tool
for Ruby programs?

A google for "Ruby Lint" didn't turn up anything obviously useful.

Regards,

Matt


12 Answers

Markus

10/25/2004 7:23:00 PM

0

What would it check for? I know I grep for "elseif" and I think my
personal extensions library still includes something like:

def elseif; raise "It's elsif you fool!" end

but (in general) I'm not sure what you would want to catch. Maybe we
could take up a collection ("My dumbest ruby gaffes" or something)?

-- Markus



On Mon, 2004-10-25 at 11:10, Matt Mower wrote:
> Hi folks.
>
> I was wondering whether anyone had done any work on a Lint style tool
> for Ruby programs?
>
> A google for "Ruby Lint" didn't turn up anything obviously useful.
>
> Regards,
>
> Matt



John Carter

10/26/2004 5:22:00 AM

0

Robert Klemme

10/26/2004 11:43:00 AM

0


"Matt Mower" <matt.mower@gmail.com> schrieb im Newsbeitrag
news:d563731904102511108047fd3@mail.gmail.com...
> Hi folks.
>
> I was wondering whether anyone had done any work on a Lint style tool
> for Ruby programs?
>
> A google for "Ruby Lint" didn't turn up anything obviously useful.

Others have provided some solutions (I'd use "ruby -cw") but IMHO it boils
down to the statement that static checks will not gain you much with Ruby
because of its dynamic nature and typeless variables. For example, you
usually can't iterate through the wrong index range on an array because
most of the time you'll be using Array#each anyway leaving little room for
off by one errors.

Kind regards

robert

gabriele renzi

10/26/2004 3:22:00 PM

0

Matt Mower ha scritto:
> Hi folks.
>
> I was wondering whether anyone had done any work on a Lint style tool
> for Ruby programs?
>
> A google for "Ruby Lint" didn't turn up anything obviously useful.
>

if you google for rubychecker you may find a thesis from a robert
feldt's student that has done something like this. I don't think he
released anything, but you may ask, maybe.

David G. Andersen

10/26/2004 10:51:00 PM

0

On Tue, Oct 26, 2004 at 02:22:26PM +0900, John Carter scribed:
>
> A very interesting question, what static analysis do we need for Ruby?

Things that look like accidental violations of variable scoping,
until the language has something a bit more elegant to handle said
scoping:

i = 3
...
arr.each { |i| do_something_with(i) }
...
print "Why is i not 3?\n"

if the project is such that it's not worth implementing unit
tests (aka, it's a quick hack), the more static analysis you
can get, the better. Plus, it's always nice to have redundancy
in your sanity checking.

-Dave

--
work: dga@lcs.mit.edu me: dga@pobox.com
MIT Laboratory for Computer Science http://www....


gabriele renzi

10/27/2004 10:55:00 AM

0

gabriele renzi ha scritto:

> if you google for rubychecker you may find a thesis from a robert
^^^^^^^^^^^

sorry, that was CheckR
(http://www.pronovomundo.com/htu/theses2004/checkr_olofsson_thesis_final_...)

John Carter

10/28/2004 12:49:00 AM

0

Robert Feldt

10/31/2004 11:32:00 AM

0

John Carter wrote:

> On Wed, 27 Oct 2004, gabriele renzi wrote:
>
>> (http://www.pronovomundo.com/htu/theses2004/checkr_olofsson_thesis_final_...)
>>
>
>
>
> I take part of what I said back. There is one idea in that thesis that
> would be pretty useful and very easy to do.
>
Only one; maybe I should rethink the approval then... ;)

I truly think there is some power in having a static analyser also for
Ruby, but after taking the "low-hanging" fruits (like the one you
mention and is talked about in the thesis) you need some kind of
intelligence / pattern-matching to find other bugs. I hope to attract
another student to go deeper/further...

Regards,

Robert




John Carter

10/31/2004 9:35:00 PM

0

Simon Strandgaard

10/31/2004 11:12:00 PM

0

On Sunday 31 October 2004 22:34, John Carter wrote:
[snip]
> Hmm. The next highest source of bugs in Ruby programs is getting
> Regexes wrong.
>
> I have one RCR in on that subject already...
> http://rcrchive.net/rc...

Sorry.. I want to advertise for my regexp package.
it can prettyprint a regexp, which sometimes can be helpful.

screenshot:
http://aeditor.rubyforge.org/aeditor_sho...

raa-entry:
http://raa.ruby-lang.org/proje...

It can be installed via RPA.. by typing
rpa install re

--
Simon Strandgaard