[Buildbot-devel] Incremental pylint
Andrew Melo
andrew.melo at gmail.com
Tue Feb 2 19:01:59 UTC 2010
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
More information about the devel
mailing list