def checkstyle(registry, xml_parent, data):
 def convert_settings(lookup, data):
  'Helper to convert settings from one key to another\n        '
  for old_key in list(data.keys()):
   if (old_key in lookup):
    data.setdefault(lookup[old_key], data[old_key])
    del data[old_key]
 checkstyle = XML.SubElement(xml_parent, 'hudson.plugins.checkstyle.CheckStylePublisher')
 checkstyle.set('plugin', 'checkstyle')
 convert_settings({'unHealthy': 'unhealthy', 'healthThreshold': 'health-threshold', 'defaultEncoding': 'default-encoding', 'canRunOnFailed': 'can-run-on-failed', 'shouldDetectModules': 'should-detect-modules'}, data)
 threshold_data = data.get('thresholds', {})
 for threshold in ['unstable', 'failed']:
  convert_settings({'totalAll': 'total-all', 'totalHigh': 'total-high', 'totalNormal': 'total-normal', 'totalLow': 'total-low'}, threshold_data.get(threshold, {}))
 helpers.build_trends_publisher('[CHECKSTYLE] ', checkstyle, data)

def checkstyle ( registry , xml_parent , data ) : def convert_settings ( lookup , data ) : for old_key in list ( data . keys ( ) ) : if ( old_key in lookup ) : data . setdefault ( lookup [ old_key ] , data [ old_key ] ) del data [ old_key ] checkstyle = XML . SubElement ( xml_parent , 'hudson.plugins.checkstyle.CheckStylePublisher' ) checkstyle . set ( 'plugin' , 'checkstyle' ) convert_settings ( { 'unHealthy' : 'unhealthy' , 'healthThreshold' : 'health-threshold' , 'defaultEncoding' : 'default-encoding' , 'canRunOnFailed' : 'can-run-on-failed' , 'shouldDetectModules' : 'should-detect-modules' } , data ) threshold_data = data . get ( 'thresholds' , { } ) for threshold in [ 'unstable' , 'failed' ] : convert_settings ( { 'totalAll' : 'total-all' , 'totalHigh' : 'total-high' , 'totalNormal' : 'total-normal' , 'totalLow' : 'total-low' } , threshold_data . get ( threshold , { } ) ) helpers . build_trends_publisher ( '[CHECKSTYLE] ' , checkstyle , data )
yaml: checkstyle publish trend reports with checkstyle .