I've not encountered a script that assessed style, but there is perltidy that will reformat according to a configurable set of rules. I wouldn't be too hard to wrap that with another script that tidied the input file then did a diff between the input and the output and made some assessment of the changes.

Though its probably simpler to insist that all code is maintained in the code repository in some standardized style (defined in terms of a Pertidy configuration for example).

That way, people who prefer, or are accustomed to a different style to the 'house style', can set their editor to use perltidy to reformat the house style to their own preferences when it loads a script and back to the house style when it saves. That way, nobody finds themselves slowed down and driven crazy because they have to keep manually re-editing the stuff they naturally type in one way, but that the house style requires in another.

This won't take care of everything on the OP's 32 point list, but then, as the thread shows, many of those points are controversial to say the least.

Personally, I find some of them bewildering. Not using $_ when appropriate is a little like forcing me to say: Mister George William? Bush Esquire, currently of sixteen hundred Pennsylvania Avenue, Washington, District of Columbia, United States of America. each time instead of "The US president". It maybe (or may not in this case, I'm not sure of all the details:) be more accurate, but boy, is is ever long-winded.

In the same way that anyone in the US has a pretty good idea what you mean when you say "The President", (though you may have to say "The US president" outside of the US), so it is with $_. Anyone with more than a passing familarity with Perl, will, in most instances recognise the meaning and value of a given use of $_ in a given context. Of course it can be abused, but so can a long variable name.

The typical notion of obfuscation is to reduce all the variable names to single chars. Much more effective is to use meduim length, descriptive names that are apparently meaningful in the given context, but just not used for the purpose they apparently serve.

In the end, no amount of automation is going to detect, never mind rectify stuff like this.


Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.


In reply to Re: Re: Perl Programming guidelines/rules by BrowserUk
in thread Perl Programming guidelines/rules by hakkr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.