[Buildbot-devel] Incremental pylint
Alexander O'Donovan-Jones
Alexander at ccpgames.com
Tue Feb 2 23:33:22 UTC 2010
Your __init__ is a little funky specifically re: onlyChanged. I think this works better.
def __init__(self, onlyChanged=False, myCommand=None, **kwargs):
if onlyChanged:
self.onlyChanged = onlyChanged
if myCommand is not None:
self.myCommand = myCommand
if 'command' in kwargs:
self.myCommand = kwargs['command']
PyLint.__init__(self, **kwargs)
self.addFactoryArguments(
onlyChanged = onlyChanged,
myCommand = myCommand )
________________________________________
From: Andrew Melo [andrew.melo at gmail.com]
Sent: 02 February 2010 19:01
To: buildbot
Subject: [Buildbot-devel] Incremental pylint
Hey all,
There was a call earlier for an incremental pylint class. It took me a
while (and it's really ugly, I had a hard time following the API to
figure out what I wanted to change), but I've been using this, and it
works fairly well. Additionally, it seems like the newer version of
pylint changed their output format, so I had to change the regex to
better match it. If someone has a suggestion on how to clean this up,
I'm all ears!
Thanks,
Andrew
class MyPyLint(PyLint):
_parseable_line_re = re.compile(r'[^:]+:\d+: \[%s[,\]] .+' %
PyLint._msgtypes_re_str)
def __init__(self, onlyChanged=False, myCommand = None, **kwargs):
if 'command' in kwargs:
self.myCommand = kwargs['command']
PyLint.__init__(self, **kwargs)
self.addFactoryArguments( onlyChanged = onlyChanged,
myCommand = myCommand )
self.onlyChanged = False
if onlyChanged is not None:
self.onlyChanged = onlyChanged
if myCommand is not None:
self.myCommand = myCommand
def start(self):
log.msg( self.build )
files = []
if self.build.getSourceStamp().changes:
for c in self.build.getSourceStamp().changes:
for fn in c.files:
files.append( fn )
log.msg( "Pylinting files: %s" % files )
if ( (not files) and (self.onlyChanged) ):
return SKIPPED
if ( (not hasattr( self, 'myCommand')) or
(self.myCommand == None )):
return PyLint.start(self)
self.setCommand( self.myCommand )
if files and self.onlyChanged:
newCommand = self.myCommand + files
self.setCommand( newCommand )
PyLint.start(self)
--
--
Andrew Melo
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Buildbot-devel mailing list
Buildbot-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/buildbot-devel
More information about the devel
mailing list