language analysis to enforce code standards

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Thu Jul 9 22:42:04 EDT 2009


On Fri, 10 Jul 2009 02:06:35 +0000, Jason S. Friedman wrote:

> Hello, I administer the Informatica ETL tool at my company.  Part of
> that role involves creating and enforcing standards.  I want the
> Informatica developers to add comments to certain key objects and I want
> to be able to verify (in an automated fashion) that they have done so.
> 
> I cannot merely check for non-emptiness; that is trivial to circumvent.
>   On the other hand, I probably do not need to be able to catch
> developers who are determined to not create comments.  There are not too
> many of them and perhaps they will find it is easier to write a (useful)
> comment than to game the system.
> 
> Any thoughts on how I might proceed?  Stated plainly, how can I tell
> when a string more-or-less forms at least one phrase?

Define "phrase".


if len(s) > 0:
    print "at least one character"
if len(s.split()) > 0:
    print "at least one word"
if len(s.split('\n') > 0:
    print "at least one line"



-- 
Steven



More information about the Python-list mailing list