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

View File

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