Skip to content

Commit 83c864d

Browse files
authored
Add new rule-test schema 1.1.0 (#23)
Refs pmd/pmd#5806
1 parent 17d75c1 commit 83c864d

File tree

5 files changed

+276
-5
lines changed

5 files changed

+276
-5
lines changed

rule-tests_1_0_0.xsd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Version 1.0.0 -->
3+
<!-- Last change: 2022-07-22 -->
24
<schema
35
xmlns="http://www.w3.org/2001/XMLSchema"
46
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
@@ -109,5 +111,4 @@
109111
</extension>
110112
</simpleContent>
111113
</complexType>
112-
113114
</schema>

rule-tests_1_1_0.xsd

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Version 1.1.0 -->
3+
<!-- Last change: 2025-06-22 -->
4+
<!-- Changes against 1.0.0: expected-suppression -->
5+
<schema
6+
xmlns="http://www.w3.org/2001/XMLSchema"
7+
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
8+
targetNamespace="http://pmd.sourceforge.net/rule-tests"
9+
elementFormDefault="qualified">
10+
11+
<element name="test-data">
12+
<complexType>
13+
<choice maxOccurs="unbounded">
14+
<element name="test-code" minOccurs="0" maxOccurs="unbounded" type="tns:testType"/>
15+
<element name="code-fragment" minOccurs="0" maxOccurs="unbounded" type="tns:codeFragmentType">
16+
<annotation>
17+
<documentation>
18+
A code fragment that can be referred to by several tests.
19+
</documentation>
20+
</annotation>
21+
</element>
22+
</choice>
23+
</complexType>
24+
</element>
25+
26+
<complexType name="testType">
27+
<sequence>
28+
<element name="description" type="string"/>
29+
<element name="rule-property" minOccurs="0" maxOccurs="unbounded">
30+
<complexType>
31+
<simpleContent>
32+
<extension base="string">
33+
<attribute name="name" type="string" use="required"/>
34+
</extension>
35+
</simpleContent>
36+
</complexType>
37+
</element>
38+
39+
<element name="expected-problems" type="nonNegativeInteger"/>
40+
<element name="expected-linenumbers" type="string" minOccurs="0"/>
41+
<element name="expected-messages" minOccurs="0">
42+
<complexType>
43+
<sequence>
44+
<element name="message" type="string" maxOccurs="unbounded"/>
45+
</sequence>
46+
</complexType>
47+
</element>
48+
<element name="expected-suppressions" minOccurs="0">
49+
<annotation>
50+
<documentation>Declares the expected suppressed violations. Since PMD 7.15.0 / rule-tests 1.1.0.</documentation>
51+
</annotation>
52+
<complexType>
53+
<sequence>
54+
<element name="suppressor" maxOccurs="unbounded">
55+
<complexType>
56+
<simpleContent>
57+
<extension base="string">
58+
<attribute name="line" type="positiveInteger" use="required"/>
59+
</extension>
60+
</simpleContent>
61+
</complexType>
62+
</element>
63+
</sequence>
64+
</complexType>
65+
</element>
66+
<choice>
67+
<element name="code" type="string"/>
68+
<element name="code-ref">
69+
<complexType>
70+
<attribute name="id" type="IDREF" use="required"/>
71+
</complexType>
72+
</element>
73+
</choice>
74+
<element name="source-type" minOccurs="0" default="" type="string">
75+
<annotation>
76+
<documentation>
77+
Language version of the source, eg 'java 8'.
78+
</documentation>
79+
</annotation>
80+
</element>
81+
</sequence>
82+
<attribute name="reinitializeRule" type="boolean" default="true">
83+
<annotation>
84+
<documentation>
85+
This attribute is deprecated, it is assumed true and ignored.
86+
</documentation>
87+
</annotation>
88+
</attribute>
89+
<attribute name="regressionTest" type="boolean" default="true">
90+
<annotation>
91+
<documentation>
92+
This attribute is deprecated. Use "disabled" instead.
93+
If this attribute is set to "false", then the test is ignored.
94+
</documentation>
95+
</annotation>
96+
</attribute>
97+
<attribute name="useAuxClasspath" type="boolean" default="true">
98+
<annotation>
99+
<documentation>
100+
This attribute is deprecated, it is assumed true and ignored.
101+
</documentation>
102+
</annotation>
103+
</attribute>
104+
105+
<attribute name="disabled" type="boolean" default="false">
106+
<annotation>
107+
<documentation>
108+
A reason why the test is disabled/ignored should be provided as a comment for the test.
109+
</documentation>
110+
</annotation>
111+
</attribute>
112+
<attribute name="focused" type="boolean" default="false">
113+
<annotation>
114+
<documentation>
115+
If true, only this test will be executed, and all others will be disabled.
116+
If several tests in the same file are focused, then the last one wins, in
117+
document order.
118+
This attribute is provided as a way for developers to temporarily focus on a single test.
119+
Test files with a focused test should not be checked in. For this reason,
120+
using this attribute produces a warning.
121+
</documentation>
122+
</annotation>
123+
</attribute>
124+
</complexType>
125+
126+
<complexType name="codeFragmentType">
127+
<simpleContent>
128+
<extension base="string">
129+
<attribute name="id" type="ID" use="required"/>
130+
</extension>
131+
</simpleContent>
132+
</complexType>
133+
</schema>

schema/index.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ title: PMD Schema
4343

4444
**Namespace:** http://pmd.sourceforge.net/rule-tests
4545

46-
**Schema Location:** <https://pmd.github.io/schema/rule-tests_1_0_0.xsd>
46+
**Schema Location:** <https://pmd.github.io/schema/rule-tests_1_1_0.xsd>
4747

48-
**Current Version:** 1.0.0
48+
**Current Version:** 1.1.0
4949

50-
**Last Change:** 2022-07-22
50+
**Last Change:** 2025-06-22
5151

5252
**Documentation:** [Testing your rules](https://docs.pmd-code.org/latest/pmd_userdocs_extending_testing.html#test-xml-reference)
53+
54+
**Old Versions:**
55+
* [1.0.0 (2022-07-22)](https://pmd.github.io/schema/rule-tests_1_0_0.xsd)

schema/rule-tests_1_0_0.xsd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Version 1.0.0 -->
3+
<!-- Last change: 2022-07-22 -->
24
<schema
35
xmlns="http://www.w3.org/2001/XMLSchema"
46
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
@@ -109,5 +111,4 @@
109111
</extension>
110112
</simpleContent>
111113
</complexType>
112-
113114
</schema>

schema/rule-tests_1_1_0.xsd

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Version 1.1.0 -->
3+
<!-- Last change: 2025-06-22 -->
4+
<!-- Changes against 1.0.0: expected-suppression -->
5+
<schema
6+
xmlns="http://www.w3.org/2001/XMLSchema"
7+
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
8+
targetNamespace="http://pmd.sourceforge.net/rule-tests"
9+
elementFormDefault="qualified">
10+
11+
<element name="test-data">
12+
<complexType>
13+
<choice maxOccurs="unbounded">
14+
<element name="test-code" minOccurs="0" maxOccurs="unbounded" type="tns:testType"/>
15+
<element name="code-fragment" minOccurs="0" maxOccurs="unbounded" type="tns:codeFragmentType">
16+
<annotation>
17+
<documentation>
18+
A code fragment that can be referred to by several tests.
19+
</documentation>
20+
</annotation>
21+
</element>
22+
</choice>
23+
</complexType>
24+
</element>
25+
26+
<complexType name="testType">
27+
<sequence>
28+
<element name="description" type="string"/>
29+
<element name="rule-property" minOccurs="0" maxOccurs="unbounded">
30+
<complexType>
31+
<simpleContent>
32+
<extension base="string">
33+
<attribute name="name" type="string" use="required"/>
34+
</extension>
35+
</simpleContent>
36+
</complexType>
37+
</element>
38+
39+
<element name="expected-problems" type="nonNegativeInteger"/>
40+
<element name="expected-linenumbers" type="string" minOccurs="0"/>
41+
<element name="expected-messages" minOccurs="0">
42+
<complexType>
43+
<sequence>
44+
<element name="message" type="string" maxOccurs="unbounded"/>
45+
</sequence>
46+
</complexType>
47+
</element>
48+
<element name="expected-suppressions" minOccurs="0">
49+
<annotation>
50+
<documentation>Declares the expected suppressed violations. Since PMD 7.15.0 / rule-tests 1.1.0.</documentation>
51+
</annotation>
52+
<complexType>
53+
<sequence>
54+
<element name="suppressor" maxOccurs="unbounded">
55+
<complexType>
56+
<simpleContent>
57+
<extension base="string">
58+
<attribute name="line" type="positiveInteger" use="required"/>
59+
</extension>
60+
</simpleContent>
61+
</complexType>
62+
</element>
63+
</sequence>
64+
</complexType>
65+
</element>
66+
<choice>
67+
<element name="code" type="string"/>
68+
<element name="code-ref">
69+
<complexType>
70+
<attribute name="id" type="IDREF" use="required"/>
71+
</complexType>
72+
</element>
73+
</choice>
74+
<element name="source-type" minOccurs="0" default="" type="string">
75+
<annotation>
76+
<documentation>
77+
Language version of the source, eg 'java 8'.
78+
</documentation>
79+
</annotation>
80+
</element>
81+
</sequence>
82+
<attribute name="reinitializeRule" type="boolean" default="true">
83+
<annotation>
84+
<documentation>
85+
This attribute is deprecated, it is assumed true and ignored.
86+
</documentation>
87+
</annotation>
88+
</attribute>
89+
<attribute name="regressionTest" type="boolean" default="true">
90+
<annotation>
91+
<documentation>
92+
This attribute is deprecated. Use "disabled" instead.
93+
If this attribute is set to "false", then the test is ignored.
94+
</documentation>
95+
</annotation>
96+
</attribute>
97+
<attribute name="useAuxClasspath" type="boolean" default="true">
98+
<annotation>
99+
<documentation>
100+
This attribute is deprecated, it is assumed true and ignored.
101+
</documentation>
102+
</annotation>
103+
</attribute>
104+
105+
<attribute name="disabled" type="boolean" default="false">
106+
<annotation>
107+
<documentation>
108+
A reason why the test is disabled/ignored should be provided as a comment for the test.
109+
</documentation>
110+
</annotation>
111+
</attribute>
112+
<attribute name="focused" type="boolean" default="false">
113+
<annotation>
114+
<documentation>
115+
If true, only this test will be executed, and all others will be disabled.
116+
If several tests in the same file are focused, then the last one wins, in
117+
document order.
118+
This attribute is provided as a way for developers to temporarily focus on a single test.
119+
Test files with a focused test should not be checked in. For this reason,
120+
using this attribute produces a warning.
121+
</documentation>
122+
</annotation>
123+
</attribute>
124+
</complexType>
125+
126+
<complexType name="codeFragmentType">
127+
<simpleContent>
128+
<extension base="string">
129+
<attribute name="id" type="ID" use="required"/>
130+
</extension>
131+
</simpleContent>
132+
</complexType>
133+
</schema>

0 commit comments

Comments
 (0)