#NEWLINE# def parse_findbugs( payload ) : #NEWLINE# #INDENT# tree = lxml . etree . fromstring ( payload ) #NEWLINE# for result in tree . xpath ( '//BugCollection/BugInstance/Class/SourceLine' ) : #NEWLINE# #INDENT# keys = result . keys ( ) #NEWLINE# p = None #NEWLINE# if ( 'start' in keys ) : #NEWLINE# #INDENT# line = result . attrib [ 'start' ] #NEWLINE# p = Point ( int ( line ) , 0 ) #NEWLINE# #UNINDENT# if ( 'end' in keys ) : #NEWLINE# #INDENT# lineEnd = result . attrib [ 'end' ] #NEWLINE# p = Point ( int ( line ) , int ( lineEnd ) ) #NEWLINE# #UNINDENT# if ( 'sourcepath' in keys ) : #NEWLINE# #INDENT# path = result . attrib [ 'sourcepath' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = 'unknown' #NEWLINE# #UNINDENT# ( message , ) = result . xpath ( '../../LongMessage' ) #NEWLINE# message = message . text #NEWLINE# testid = result . getparent ( ) . getparent ( ) . attrib [ 'instanceHash' ] #NEWLINE# rank = result . getparent ( ) . getparent ( ) . attrib [ 'rank' ] #NEWLINE# if ( rank <= 4 ) : #NEWLINE# #INDENT# severity = 'scariest' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rank <= 9 ) : #NEWLINE# #INDENT# severity = 'scary' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rank <= 14 ) : #NEWLINE# #INDENT# severity = 'troubling' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# severity = 'concern' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# ( yield Issue ( cwe = None , testid = testid , location = Location ( file = File ( path , None ) , function = None , point = testid ) , severity = severity , message = Message ( text = message ) , notes = None , trace = None ) )