Change pep8 publisher to generic violations.

Change-Id: I94abedc07e0e5884cd737975c65d53375c598f14
Reviewed-on: https://review.openstack.org/11501
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2012-08-16 13:34:12 -07:00 committed by Jenkins
parent fb0a113eff
commit 13aab58c91
2 changed files with 32 additions and 36 deletions

View File

@ -171,22 +171,26 @@ def junit(parser, xml_parent, data):
XML.SubElement(junitresult, 'testDataPublishers') XML.SubElement(junitresult, 'testDataPublishers')
def _pep8_add_entry(xml_parent, name): def _violations_add_entry(xml_parent, name, data):
vmin = data.get('min', 10)
vmax = data.get('max', 999)
vunstable = data.get('unstable', 999)
pattern = data.get('pattern', None)
entry = XML.SubElement(xml_parent, 'entry') entry = XML.SubElement(xml_parent, 'entry')
XML.SubElement(entry, 'string').text = name XML.SubElement(entry, 'string').text = name
tconfig = XML.SubElement(entry, 'hudson.plugins.violations.TypeConfig') tconfig = XML.SubElement(entry, 'hudson.plugins.violations.TypeConfig')
XML.SubElement(tconfig, 'type').text = name XML.SubElement(tconfig, 'type').text = name
XML.SubElement(tconfig, 'min').text = '10' XML.SubElement(tconfig, 'min').text = str(vmin)
XML.SubElement(tconfig, 'max').text = '999' XML.SubElement(tconfig, 'max').text = str(vmax)
XML.SubElement(tconfig, 'unstable').text = '999' XML.SubElement(tconfig, 'unstable').text = str(vunstable)
XML.SubElement(tconfig, 'usePattern').text = 'false' XML.SubElement(tconfig, 'usePattern').text = 'false'
if pattern:
XML.SubElement(tconfig, 'pattern').text = pattern
else:
XML.SubElement(tconfig, 'pattern') XML.SubElement(tconfig, 'pattern')
def violations(parser, xml_parent, data):
# Jenkins Job module for pep8 publishers
# No additional YAML needed
def pep8(parser, xml_parent, data):
violations = XML.SubElement(xml_parent, violations = XML.SubElement(xml_parent,
'hudson.plugins.violations.ViolationsPublisher') 'hudson.plugins.violations.ViolationsPublisher')
config = XML.SubElement(violations, 'config') config = XML.SubElement(violations, 'config')
@ -196,31 +200,23 @@ def pep8(parser, xml_parent, data):
configs = XML.SubElement(config, 'typeConfigs') configs = XML.SubElement(config, 'typeConfigs')
XML.SubElement(configs, 'no-comparator') XML.SubElement(configs, 'no-comparator')
_pep8_add_entry(configs, 'checkstyle') for name in [
_pep8_add_entry(configs, 'codenarc') 'checkstyle',
_pep8_add_entry(configs, 'cpd') 'codenarc',
_pep8_add_entry(configs, 'cpplint') 'cpd',
_pep8_add_entry(configs, 'csslint') 'cpplint',
_pep8_add_entry(configs, 'findbugs') 'csslint',
_pep8_add_entry(configs, 'fxcop') 'findbugs',
_pep8_add_entry(configs, 'gendarme') 'fxcop',
_pep8_add_entry(configs, 'jcreport') 'gendarme',
_pep8_add_entry(configs, 'jslint') 'jcreport',
'jslint',
entry = XML.SubElement(configs, 'entry') 'pep8',
XML.SubElement(entry, 'string').text = 'pep8' 'pmd',
tconfig = XML.SubElement(entry, 'hudson.plugins.violations.TypeConfig') 'pylint',
XML.SubElement(tconfig, 'type').text = 'pep8' 'simian',
XML.SubElement(tconfig, 'min').text = '0' 'stylecop']:
XML.SubElement(tconfig, 'max').text = '1' _violations_add_entry(configs, name, data.get(name, {}))
XML.SubElement(tconfig, 'unstable').text = '1'
XML.SubElement(tconfig, 'usePattern').text = 'false'
XML.SubElement(tconfig, 'pattern').text = '**/pep8.txt'
_pep8_add_entry(configs, 'pmd')
_pep8_add_entry(configs, 'pylint')
_pep8_add_entry(configs, 'simian')
_pep8_add_entry(configs, 'stylecop')
XML.SubElement(config, 'limit').text = '100' XML.SubElement(config, 'limit').text = '100'
XML.SubElement(config, 'sourcePathPattern') XML.SubElement(config, 'sourcePathPattern')

View File

@ -58,7 +58,7 @@ setup(name='jenkins_job_builder',
'coverage=jenkins_jobs.modules.publishers:coverage', 'coverage=jenkins_jobs.modules.publishers:coverage',
'ftp=jenkins_jobs.modules.publishers:ftp', 'ftp=jenkins_jobs.modules.publishers:ftp',
'junit=jenkins_jobs.modules.publishers:junit', 'junit=jenkins_jobs.modules.publishers:junit',
'pep8=jenkins_jobs.modules.publishers:pep8', 'violations=jenkins_jobs.modules.publishers:violations',
'scp=jenkins_jobs.modules.publishers:scp', 'scp=jenkins_jobs.modules.publishers:scp',
], ],
'jenkins_jobs.scm': [ 'jenkins_jobs.scm': [