<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Alexey Shrub</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/alexey_shrub/" />
    <link rel="self" type="application/atom+xml" href="http://blogs.perl.org/users/alexey_shrub/atom.xml" />
    <id>tag:blogs.perl.org,2009-11-03:/users/alexey_shrub//726</id>
    <updated>2011-02-17T23:03:58Z</updated>
    <subtitle>A blog about the Perl programming language</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.38</generator>

<entry>
    <title>Non-functional perl code testing - automated code review</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/alexey_shrub/2011/02/non-functional-perl-code-testing---automated-code-review.html" />
    <id>tag:blogs.perl.org,2011:/users/alexey_shrub//726.1476</id>

    <published>2011-02-17T06:48:08Z</published>
    <updated>2011-02-17T23:03:58Z</updated>

    <summary>I saw a very ugly Perl code, and I think that is possible because no code review exist in project. But always we have a very little time for human code review. I search CPAN modules for basic level code...</summary>
    <author>
        <name>Alexey Shrub</name>
        <uri>http://worldmind.livejournal.com</uri>
    </author>
    
    <category term="codereview" label="code review" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="unittesting" label="unit testing" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/alexey_shrub/">
        <![CDATA[<p>I saw a very ugly <a href="http://www.perl.org/">Perl</a> code, and I think that is possible because no code review exist in project. But always we have a very little time for human code review. I search <a href="http://www.cpan.org/">CPAN</a> modules for basic level code review by machine. I hope that these modules help Perl people to avoid writing ugly code and help team leaders minimize time to code review.
I try to collect founded modules in <a href="https://github.com/worldmind/perl-test-code-quality-template">github repository</a> and now want to describe what we know if all these test passed:</p>

<ol>
<li>Module have valid syntax and have strict and warnings pragmas - thanks to <a href="http://search.cpan.org/perldoc?Test::Strict">Test::Strict</a></li>
<li>Module have only unix line endings and not have whitespaces in the end of line - thanks to <a href="http://search.cpan.org/perldoc?Test::EOL">Test::EOL</a></li>
<li>Module have no FIXME notes - thanks to <a href="http://search.cpan.org/perldoc?Test::Fixme">Test::Fixme</a></li>
<li>Module have no soft breakpoints for perl debugger - thanks to <a href="http://search.cpan.org/perldoc?Test::NoBreakpoints">Test::NoBreakpoints</a></li>
<li>Module have no tabs - thanks to <a href="http://search.cpan.org/perldoc?Test::NoTabs">Test::NoTabs</a></li>
<li>Module distribution looks good to upload to cpan - thanks to <a href="http://search.cpan.org/perldoc?Test::Kwalitee">Test::Kwalitee</a></li>
<li>Code units in module have required <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">cyclomatic complexity</a> and required lines of code - thanks to <a href="http://search.cpan.org/perldoc?Perl::Metrics::Simple">Perl::Metrics::Simple</a>. I try to use <a href="http://search.cpan.org/perldoc?Test::Perl::Metrics::Simple">Test::Perl::Metrics::Simple</a>, but got <a href="https://rt.cpan.org/Public/Bug/Display.html?id=64305">problem</a> with installing and write my own test.</li>
<li>Module code is conform to <a href="http://oreilly.com/catalog/9780596001735">Perl Best Practice</a> recommendation from <a href="http://search.cpan.org/perldoc?Perl::Critic">Perl::Critic</a> - thanks to <a href="http://search.cpan.org/perldoc?Test::Perl::Critic">Test::Perl::Critic</a></li>
<li>Module has <a href="http://en.wikipedia.org/wiki/Plain_Old_Documentation">POD</a> and it is valid - thanks to <a href="http://search.cpan.org/perldoc?Test::Pod">Test::Pod</a></li>
<li>POD cover all methods - thanks to <a href="http://search.cpan.org/perldoc?Test::Pod::Coverage">Test::Pod::Coverage</a></li>
<li>POD is written on valid human language - thanks <a href="http://search.cpan.org/perldoc?Test::Spelling">Test::Spelling</a></li>
<li>The tests written for module cover needed percent of code - thanks to <a href="http://search.cpan.org/perldoc?Test::Strict">Test::Strict</a> and <a href="http://search.cpan.org/perldoc?Devel::Cover">Devel::Cover</a></li>
<li>Module has no memory leaks - thanks to <a href="http://search.cpan.org/perldoc?Test::Weaken">Test::Weaken</a> - this test is non functional, but because it is not universal (if we add method we must add test) I move it to 't' directory with functional tests</li>
</ol>

<p>That I not found:</p>

<ol>
<li>Test for <a href="http://www.aivosto.com/project/help/pm-complexity.html#DCOND">depth of conditional nesting</a> <a href="http://en.wikipedia.org/wiki/Software_metric">code metric</a></li>
<li>Test for code style - I found <a href="http://search.cpan.org/perldoc?Test::PerlTidy">Test::PerlTidy</a>, but it have some <a href="https://rt.cpan.org/Public/Dist/Display.html?Name=Test-PerlTidy">bugs</a>, I wrote to author, he said than plan fix it</li>
</ol>

<p>I try to collect maximum non-functional test collection - you can use that you need only. I hope that it post will be useful for somebody and I will be glad any comments.</p>

<p>Sorry, if my English is not good.</p>
]]>
        

    </content>
</entry>

</feed>
