Update sloccount plugin
- update sloccount plugin to convert xml - add new parameters - add plugin='sloccount' attribute - update docstring - update test cases Change-Id: I74919fdd18d2d22ab07e7cd1e48df6572db8885b
This commit is contained in:
parent
ce758e2dd0
commit
7484342137
|
@ -3914,25 +3914,41 @@ def sloccount(registry, xml_parent, data):
|
|||
Requires the Jenkins :jenkins-wiki:`SLOCCount Plugin <SLOCCount+Plugin>`.
|
||||
|
||||
:arg str report-files: Setting that specifies the generated raw
|
||||
SLOCCount report files.
|
||||
Be sure not to include any non-report files into
|
||||
this pattern. The report files must have been
|
||||
generated by sloccount using the
|
||||
"--wide --details" options.
|
||||
(default '\*\*/sloccount.sc')
|
||||
SLOCCount report files. Be sure not to include any non-report files
|
||||
into this pattern. The report files must have been generated by
|
||||
sloccount using the "--wide --details" options.
|
||||
(default '\*\*/sloccount.sc')
|
||||
:arg str charset: The character encoding to be used to read the SLOCCount
|
||||
result files. (default 'UTF-8')
|
||||
result files. (default 'UTF-8')
|
||||
:arg int builds-in-graph: Maximal number of last successful builds, that
|
||||
are displayed in the trend graphs. (default 0)
|
||||
:arg bool comment-is-code: This option is considered only in the cloc
|
||||
report parser and is ignored in the SLOCCount one. (default false)
|
||||
:arg bool ignore-build-failure: Try to process the report files even if
|
||||
the build is not successful. (default false)
|
||||
|
||||
Example:
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/sloccount001.yaml
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/sloccount-minimal.yaml
|
||||
:language: yaml
|
||||
|
||||
Full Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/publishers/fixtures/sloccount-complete.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
top = XML.SubElement(xml_parent,
|
||||
'hudson.plugins.sloccount.SloccountPublisher')
|
||||
XML.SubElement(top, 'pattern').text = data.get('report-files',
|
||||
'**/sloccount.sc')
|
||||
XML.SubElement(top, 'encoding').text = data.get('charset', 'UTF-8')
|
||||
top.set('plugin', 'sloccount')
|
||||
mappings = [
|
||||
('report-files', 'pattern', '**/sloccount.sc'),
|
||||
('charset', 'encoding', 'UTF-8'),
|
||||
('builds-in-graph', 'numBuildsInGraph', 0),
|
||||
('comment-is-code', 'commentIsCode', False),
|
||||
('ignore-build-failure', 'ignoreBuildFailure', False)
|
||||
]
|
||||
helpers.convert_mapping_to_xml(top, data, mappings, fail_required=True)
|
||||
|
||||
|
||||
def ircbot(registry, xml_parent, data):
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<hudson.plugins.sloccount.SloccountPublisher>
|
||||
<hudson.plugins.sloccount.SloccountPublisher plugin="sloccount">
|
||||
<pattern>sloccount.sc</pattern>
|
||||
<encoding>latin-1</encoding>
|
||||
<numBuildsInGraph>1</numBuildsInGraph>
|
||||
<commentIsCode>true</commentIsCode>
|
||||
<ignoreBuildFailure>true</ignoreBuildFailure>
|
||||
</hudson.plugins.sloccount.SloccountPublisher>
|
||||
</publishers>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
publishers:
|
||||
- sloccount:
|
||||
report-files: sloccount.sc
|
||||
charset: latin-1
|
||||
builds-in-graph: 1
|
||||
comment-is-code: true
|
||||
ignore-build-failure: true
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<hudson.plugins.sloccount.SloccountPublisher plugin="sloccount">
|
||||
<pattern>**/sloccount.sc</pattern>
|
||||
<encoding>UTF-8</encoding>
|
||||
<numBuildsInGraph>0</numBuildsInGraph>
|
||||
<commentIsCode>false</commentIsCode>
|
||||
<ignoreBuildFailure>false</ignoreBuildFailure>
|
||||
</hudson.plugins.sloccount.SloccountPublisher>
|
||||
</publishers>
|
||||
</project>
|
|
@ -0,0 +1,2 @@
|
|||
publishers:
|
||||
- sloccount
|
|
@ -1,4 +0,0 @@
|
|||
publishers:
|
||||
- sloccount:
|
||||
report-files: sloccount.sc
|
||||
charset: latin-1
|
Loading…
Reference in New Issue