<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Static analysis for Ruby/Python</title>
	<atom:link href="http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=static-analysis-for-rubypython</link>
	<description>&#62;kloctalk is a blog and a community for software development professionals who create and maintain mission-critical software and the challenges they face on a daily basis.</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:57:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: Igor Bronshteyn</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-6066</link>
		<dc:creator>Igor Bronshteyn</dc:creator>
		<pubDate>Sun, 29 May 2011 18:15:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-6066</guid>
		<description>I can&#039;t tell something regarding Ruby, but as for Python I could imagine 3 of 4 defects you mentioned:
* null pointer dereference – OK, let&#039;s call it not NPD, but None-dereference
* array bounds violation – there&#039;s an exception if your list index is out of range
* memory leaks – rare, but possible, if you have reference cycles (http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks).

But I guess that all of these defects are quite rare, and one must take a start from a true-to-life defects, not just apply an approach to statically-typed languages here.</description>
		<content:encoded><![CDATA[<p>I can&#8217;t tell something regarding Ruby, but as for Python I could imagine 3 of 4 defects you mentioned:<br />
* null pointer dereference – OK, let&#8217;s call it not NPD, but None-dereference<br />
* array bounds violation – there&#8217;s an exception if your list index is out of range<br />
* memory leaks – rare, but possible, if you have reference cycles (<a href="http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks" rel="nofollow">http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks</a>).</p>
<p>But I guess that all of these defects are quite rare, and one must take a start from a true-to-life defects, not just apply an approach to statically-typed languages here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Delicious Bookmarks for March 20th through March 21st &#171; Lâmôlabs</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1817</link>
		<dc:creator>Delicious Bookmarks for March 20th through March 21st &#171; Lâmôlabs</dc:creator>
		<pubDate>Sun, 21 Mar 2010 06:34:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1817</guid>
		<description>[...] Static analysis for Ruby/Python &#124; &gt;kloctalk &#8211; March 21st  %(postalicious-tags)( tags: ruby python static analysis reek tools tips tricks guide )% [...]</description>
		<content:encoded><![CDATA[<p>[...] Static analysis for Ruby/Python | &gt;kloctalk &#8211; March 21st  %(postalicious-tags)( tags: ruby python static analysis reek tools tips tricks guide )% [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Concept of inheritence? - Website Babble Webmaster Forums</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1473</link>
		<dc:creator>Concept of inheritence? - Website Babble Webmaster Forums</dc:creator>
		<pubDate>Wed, 24 Feb 2010 14:33:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1473</guid>
		<description>[...] derived from multiple (two)childs of the parent class. __________________ bug identification &#124; c++ static analysis &#124; code [...]</description>
		<content:encoded><![CDATA[<p>[...] derived from multiple (two)childs of the parent class. __________________ bug identification | c++ static analysis | code [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1060</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Thu, 14 Jan 2010 08:57:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1060</guid>
		<description>Check out &quot;Pex Microsoft&quot;

It just shows what is going to come down the line when it comes to analysis tools.

Personally, the next big thing is going to be design by contract. DBC opens up software for lots of things. Interestingly it reduces the need for unit tests. After all, if the code is being tested for all cases you come across, rather than the handfull that are in unit tests, you are going to get better code as a result. 

Combine that with Pex where it uses the debugging library to trace tests, and then uses this analysis to find cases that will test other paths through your code, and you are running at a level of testing far above that which can be achieved by hand</description>
		<content:encoded><![CDATA[<p>Check out &#8220;Pex Microsoft&#8221;</p>
<p>It just shows what is going to come down the line when it comes to analysis tools.</p>
<p>Personally, the next big thing is going to be design by contract. DBC opens up software for lots of things. Interestingly it reduces the need for unit tests. After all, if the code is being tested for all cases you come across, rather than the handfull that are in unit tests, you are going to get better code as a result. </p>
<p>Combine that with Pex where it uses the debugging library to trace tests, and then uses this analysis to find cases that will test other paths through your code, and you are running at a level of testing far above that which can be achieved by hand</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1057</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 13 Jan 2010 19:22:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1057</guid>
		<description>1. Memory leaks still happen in Ruby.  Objects that contain references to them are not GC&#039;d.
2. Joe Damato has been doing some interesting things with libdl:
http://timetobleed.com/extending-ltrace-to-make-your-rubypythonperlphp-apps-faster/
http://timetobleed.com/memprof-a-ruby-level-memory-profiler/
His blog is worth a good read regarding this topic</description>
		<content:encoded><![CDATA[<p>1. Memory leaks still happen in Ruby.  Objects that contain references to them are not GC&#8217;d.<br />
2. Joe Damato has been doing some interesting things with libdl:<br />
<a href="http://timetobleed.com/extending-ltrace-to-make-your-rubypythonperlphp-apps-faster/" rel="nofollow">http://timetobleed.com/extending-ltrace-to-make-your-rubypythonperlphp-apps-faster/</a><br />
<a href="http://timetobleed.com/memprof-a-ruby-level-memory-profiler/" rel="nofollow">http://timetobleed.com/memprof-a-ruby-level-memory-profiler/</a><br />
His blog is worth a good read regarding this topic</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: André Roberge</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1055</link>
		<dc:creator>André Roberge</dc:creator>
		<pubDate>Wed, 13 Jan 2010 16:55:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1055</guid>
		<description>For python, you might want to include Clone Digger (http://clonedigger.sourceforge.net/).</description>
		<content:encoded><![CDATA[<p>For python, you might want to include Clone Digger (<a href="http://clonedigger.sourceforge.net/" rel="nofollow">http://clonedigger.sourceforge.net/</a>).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Peters</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1050</link>
		<dc:creator>Michael Peters</dc:creator>
		<pubDate>Tue, 12 Jan 2010 15:35:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1050</guid>
		<description>Just to make your overview of dynamic languages more complete, Perl has Perl::Critic (http://search.cpan.org/perldoc?Perl::Critic) which is similar to Reek.</description>
		<content:encoded><![CDATA[<p>Just to make your overview of dynamic languages more complete, Perl has Perl::Critic (<a href="http://search.cpan.org/perldoc?Perl::Critic" rel="nofollow">http://search.cpan.org/perldoc?Perl::Critic</a>) which is similar to Reek.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Astor</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1048</link>
		<dc:creator>Astor</dc:creator>
		<pubDate>Tue, 12 Jan 2010 02:34:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1048</guid>
		<description>C has been around for so long and very prone to many issues so unique tools were created to help those issues. While python and ruby make programming fun and exciting for many more people than C. It&#039;s still imperative that C has it&#039;s suit of tools that make it bearable for the large extent of it&#039;s programmers. Yes people like programming in C</description>
		<content:encoded><![CDATA[<p>C has been around for so long and very prone to many issues so unique tools were created to help those issues. While python and ruby make programming fun and exciting for many more people than C. It&#8217;s still imperative that C has it&#8217;s suit of tools that make it bearable for the large extent of it&#8217;s programmers. Yes people like programming in C</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heikki Toivonen</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1047</link>
		<dc:creator>Heikki Toivonen</dc:creator>
		<pubDate>Mon, 11 Jan 2010 22:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1047</guid>
		<description>I would love to have a tool that could do more heavy-weight analysis on Python code. For example, suppose you call foo() 100 times in your application, and check the return value 99 times. It would be nice if there was a tool that could flag you to take a look at that one call where you didn&#039;t check the return value.

I am not even too concerned about things like eval or calling functions in other clever ways that would not be caught by static analyzers. If a tool caught the normal cases that would still be a big win.</description>
		<content:encoded><![CDATA[<p>I would love to have a tool that could do more heavy-weight analysis on Python code. For example, suppose you call foo() 100 times in your application, and check the return value 99 times. It would be nice if there was a tool that could flag you to take a look at that one call where you didn&#8217;t check the return value.</p>
<p>I am not even too concerned about things like eval or calling functions in other clever ways that would not be caught by static analyzers. If a tool caught the normal cases that would still be a big win.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vidar Hokstad</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-1044</link>
		<dc:creator>Vidar Hokstad</dc:creator>
		<pubDate>Mon, 11 Jan 2010 13:50:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-1044</guid>
		<description>It&#039;s not just that Ruby developers want different things, but that almost everything a typical static analysis tool does in C/C++ is next to impossible to check for in Ruby without first making a lot of assumptions which may or may not hold.

Doing a &quot;proper&quot; static analysis tool + type inference in Ruby isn&#039;t *impossible* but it would require the user to make a lot of promises to the checker about what you do (or don&#039;t do).

For example, in the presence of a single eval() that takes a user provided string in a Ruby program, you *can&#039;t* statically determine what type an object has, or what method a class has, or how many arguments (and of what type) a method takes. Effectively the world becomes almost entirely unknown past that point. The way around that is for the developer to effectively say &quot;yeah, but we only ever feed this eval() code that is restricted to these types of effects: A, B, C&quot;

The same is the case for a lot of things, such as runtime &quot;require&quot; of files based on a string that may not be possible to statically determine.

Handling that kind of user annotation adds a *lot* of complexity. You can of course provide reasonable defaults. E.g. it&#039;s reasonable 99.9% of the time to assume nobody will add instance variables to FixNum&#039;s, or overload the &quot;+&quot; method of String to do something other than concatenation, even in the presence of eval(). 

But there&#039;s a big grey area of things that may not be common, but that happens. Getting a Ruby-tool like this as comprehensive as one for C is a *huge* task.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not just that Ruby developers want different things, but that almost everything a typical static analysis tool does in C/C++ is next to impossible to check for in Ruby without first making a lot of assumptions which may or may not hold.</p>
<p>Doing a &#8220;proper&#8221; static analysis tool + type inference in Ruby isn&#8217;t *impossible* but it would require the user to make a lot of promises to the checker about what you do (or don&#8217;t do).</p>
<p>For example, in the presence of a single eval() that takes a user provided string in a Ruby program, you *can&#8217;t* statically determine what type an object has, or what method a class has, or how many arguments (and of what type) a method takes. Effectively the world becomes almost entirely unknown past that point. The way around that is for the developer to effectively say &#8220;yeah, but we only ever feed this eval() code that is restricted to these types of effects: A, B, C&#8221;</p>
<p>The same is the case for a lot of things, such as runtime &#8220;require&#8221; of files based on a string that may not be possible to statically determine.</p>
<p>Handling that kind of user annotation adds a *lot* of complexity. You can of course provide reasonable defaults. E.g. it&#8217;s reasonable 99.9% of the time to assume nobody will add instance variables to FixNum&#8217;s, or overload the &#8220;+&#8221; method of String to do something other than concatenation, even in the presence of eval(). </p>
<p>But there&#8217;s a big grey area of things that may not be common, but that happens. Getting a Ruby-tool like this as comprehensive as one for C is a *huge* task.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paddy3118</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-329</link>
		<dc:creator>Paddy3118</dc:creator>
		<pubDate>Tue, 30 Jun 2009 14:40:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-329</guid>
		<description>Hi,
You should make the point that there can be very little that a static, compile-time checker can do except suggest problems, as the code can be changed dramatically at run time. objects are typed rather than variable names; containers such as lists and dicts can have values of more than one type; duck typing; ...., and when you get right down to it, you need the tests anyway.

It would be great if you could break into a running program and do some type analysis for dynamic languages.

- Paddy.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
You should make the point that there can be very little that a static, compile-time checker can do except suggest problems, as the code can be changed dramatically at run time. objects are typed rather than variable names; containers such as lists and dicts can have values of more than one type; duck typing; &#8230;., and when you get right down to it, you need the tests anyway.</p>
<p>It would be great if you could break into a running program and do some type analysis for dynamic languages.</p>
<p>- Paddy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Denis Sidorov</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-328</link>
		<dc:creator>Denis Sidorov</dc:creator>
		<pubDate>Tue, 30 Jun 2009 12:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-328</guid>
		<description>@Kevin: Yes, most of the Ruby projects doing program analysis (including Reek) are pretty young. I guess one of the reasons is that ParseTree API was introduced not very long ago.

And, I&#039;m certainly not trying to judge :) I&#039;d like see if Ruby can break yet another stereotype and re-define program analysis (e.g. the way it redefined Web Frameworks). It is particularly interesting how Ruby error detection tools would approach the infamous &quot;false positive&quot; problem - an inherent weakness of all static analysis tools, when a real error/flaw could sometimes be buried under a pile of falsely reported issues.

BTW, have you tried Reek on some large Ruby codebases, like Rails? How many code smells were found? Got any interesting ideas on how to triage the detected smells?</description>
		<content:encoded><![CDATA[<p>@Kevin: Yes, most of the Ruby projects doing program analysis (including Reek) are pretty young. I guess one of the reasons is that ParseTree API was introduced not very long ago.</p>
<p>And, I&#8217;m certainly not trying to judge :) I&#8217;d like see if Ruby can break yet another stereotype and re-define program analysis (e.g. the way it redefined Web Frameworks). It is particularly interesting how Ruby error detection tools would approach the infamous &#8220;false positive&#8221; problem &#8211; an inherent weakness of all static analysis tools, when a real error/flaw could sometimes be buried under a pile of falsely reported issues.</p>
<p>BTW, have you tried Reek on some large Ruby codebases, like Rails? How many code smells were found? Got any interesting ideas on how to triage the detected smells?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Rutherford</title>
		<link>http://www.klocwork.com/blog/2009/06/static-analysis-for-rubypython/comment-page-1/#comment-327</link>
		<dc:creator>Kevin Rutherford</dc:creator>
		<pubDate>Mon, 29 Jun 2009 14:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=207#comment-327</guid>
		<description>Hi, Thanks for the brief objective look at Reek! Please bear in mind that Reek is very much a work in progress (look at its Issues page on github and you&#039;ll see I have many more code smells and other checks still to add). As you suspect, it is also intended as an experiment, to see just how far we can go without static analysis in Ruby.

But I think the main thing to note is that a number of such tools have sprung up for Ruby in the last year, possibly indicating a lot about the maturing of the Ruby community.</description>
		<content:encoded><![CDATA[<p>Hi, Thanks for the brief objective look at Reek! Please bear in mind that Reek is very much a work in progress (look at its Issues page on github and you&#8217;ll see I have many more code smells and other checks still to add). As you suspect, it is also intended as an experiment, to see just how far we can go without static analysis in Ruby.</p>
<p>But I think the main thing to note is that a number of such tools have sprung up for Ruby in the last year, possibly indicating a lot about the maturing of the Ruby community.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

