diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py
index 519e3f7ad..22fba9ca2 100644
--- a/jenkins_jobs/modules/publishers.py
+++ b/jenkins_jobs/modules/publishers.py
@@ -1060,19 +1060,14 @@ def checkstyle(parser, xml_parent, data):
:arg str defaultEncoding: encoding for parsing or showing files
(empty will use platform default)
- Example::
+ Example:
+
+ .. literalinclude:: /../../tests/publishers/fixtures/checkstyle001.yaml
+
+ Full example:
+
+ .. literalinclude:: /../../tests/publishers/fixtures/checkstyle002.yaml
- publishers:
- - checkstyle:
- pattern: '**/checkstyle-result.xml'
- healthy: 0
- unHealthy: 100
- healthThreshold: 'high'
- thresholds:
- unstable:
- totalHigh: 10
- failed:
- totalHigh: 1
"""
checkstyle = XML.SubElement(xml_parent,
'hudson.plugins.checkstyle.'
diff --git a/tests/publishers/fixtures/checkstyle001.xml b/tests/publishers/fixtures/checkstyle001.xml
new file mode 100644
index 000000000..ac3edc2a2
--- /dev/null
+++ b/tests/publishers/fixtures/checkstyle001.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ 100
+ high
+ [CHECKSTYLE]
+
+ false
+ false
+ false
+
+
+ 10
+
+
+
+ 1
+
+
+
+ false
+ true
+ false
+ **/checkstyle-result.xml
+
+
+
diff --git a/tests/publishers/fixtures/checkstyle001.yaml b/tests/publishers/fixtures/checkstyle001.yaml
new file mode 100644
index 000000000..bbbf08e14
--- /dev/null
+++ b/tests/publishers/fixtures/checkstyle001.yaml
@@ -0,0 +1,11 @@
+publishers:
+ - checkstyle:
+ pattern: '**/checkstyle-result.xml'
+ healthy: 0
+ unHealthy: 100
+ healthThreshold: 'high'
+ thresholds:
+ unstable:
+ totalHigh: 10
+ failed:
+ totalHigh: 1
diff --git a/tests/publishers/fixtures/checkstyle002.xml b/tests/publishers/fixtures/checkstyle002.xml
new file mode 100644
index 000000000..29a1686cc
--- /dev/null
+++ b/tests/publishers/fixtures/checkstyle002.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ 100
+ high
+ [CHECKSTYLE]
+ utf-8
+ true
+ false
+ false
+
+ 90
+ 80
+ 70
+ 60
+ 90
+ 80
+ 70
+ 60
+
+ true
+ true
+ false
+ **/checkstyle-result.xml
+
+
+
diff --git a/tests/publishers/fixtures/checkstyle002.yaml b/tests/publishers/fixtures/checkstyle002.yaml
new file mode 100644
index 000000000..1e45c25f6
--- /dev/null
+++ b/tests/publishers/fixtures/checkstyle002.yaml
@@ -0,0 +1,20 @@
+publishers:
+ - checkstyle:
+ pattern: '**/checkstyle-result.xml'
+ canRunOnFailed: true
+ shouldDetectModules: true
+ healthy: 0
+ unHealthy: 100
+ healthThreshold: 'high'
+ thresholds:
+ unstable:
+ totalAll: 90
+ totalHigh: 80
+ totalNormal: 70
+ totalLow: 60
+ failed:
+ totalAll: 90
+ totalHigh: 80
+ totalNormal: 70
+ totalLow: 60
+ defaultEncoding: 'utf-8'
diff --git a/tests/publishers/fixtures/checkstyle003.xml b/tests/publishers/fixtures/checkstyle003.xml
new file mode 100644
index 000000000..df211bb81
--- /dev/null
+++ b/tests/publishers/fixtures/checkstyle003.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ low
+ [CHECKSTYLE]
+
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+ false
+ true
+ false
+
+
+
+
diff --git a/tests/publishers/fixtures/checkstyle003.yaml b/tests/publishers/fixtures/checkstyle003.yaml
new file mode 100644
index 000000000..24201cbbb
--- /dev/null
+++ b/tests/publishers/fixtures/checkstyle003.yaml
@@ -0,0 +1,2 @@
+publishers:
+ - checkstyle