Skip to content

Add new rule-test schema 1.1.0 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rule-tests_1_0_0.xsd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0.0 -->
<!-- Last change: 2022-07-22 -->
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
Expand Down Expand Up @@ -109,5 +111,4 @@
</extension>
</simpleContent>
</complexType>

</schema>
133 changes: 133 additions & 0 deletions rule-tests_1_1_0.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.1.0 -->
<!-- Last change: 2025-06-22 -->
<!-- Changes against 1.0.0: expected-suppression -->
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
targetNamespace="http://pmd.sourceforge.net/rule-tests"
elementFormDefault="qualified">

<element name="test-data">
<complexType>
<choice maxOccurs="unbounded">
<element name="test-code" minOccurs="0" maxOccurs="unbounded" type="tns:testType"/>
<element name="code-fragment" minOccurs="0" maxOccurs="unbounded" type="tns:codeFragmentType">
<annotation>
<documentation>
A code fragment that can be referred to by several tests.
</documentation>
</annotation>
</element>
</choice>
</complexType>
</element>

<complexType name="testType">
<sequence>
<element name="description" type="string"/>
<element name="rule-property" minOccurs="0" maxOccurs="unbounded">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name" type="string" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>

<element name="expected-problems" type="nonNegativeInteger"/>
<element name="expected-linenumbers" type="string" minOccurs="0"/>
<element name="expected-messages" minOccurs="0">
<complexType>
<sequence>
<element name="message" type="string" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="expected-suppressions" minOccurs="0">
<annotation>
<documentation>Declares the expected suppressed violations. Since PMD 7.15.0 / rule-tests 1.1.0.</documentation>
</annotation>
<complexType>
<sequence>
<element name="suppressor" maxOccurs="unbounded">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="line" type="positiveInteger" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
</complexType>
</element>
<choice>
<element name="code" type="string"/>
<element name="code-ref">
<complexType>
<attribute name="id" type="IDREF" use="required"/>
</complexType>
</element>
</choice>
<element name="source-type" minOccurs="0" default="" type="string">
<annotation>
<documentation>
Language version of the source, eg 'java 8'.
</documentation>
</annotation>
</element>
</sequence>
<attribute name="reinitializeRule" type="boolean" default="true">
<annotation>
<documentation>
This attribute is deprecated, it is assumed true and ignored.
</documentation>
</annotation>
</attribute>
<attribute name="regressionTest" type="boolean" default="true">
<annotation>
<documentation>
This attribute is deprecated. Use "disabled" instead.
If this attribute is set to "false", then the test is ignored.
</documentation>
</annotation>
</attribute>
<attribute name="useAuxClasspath" type="boolean" default="true">
<annotation>
<documentation>
This attribute is deprecated, it is assumed true and ignored.
</documentation>
</annotation>
</attribute>

<attribute name="disabled" type="boolean" default="false">
<annotation>
<documentation>
A reason why the test is disabled/ignored should be provided as a comment for the test.
</documentation>
</annotation>
</attribute>
<attribute name="focused" type="boolean" default="false">
<annotation>
<documentation>
If true, only this test will be executed, and all others will be disabled.
If several tests in the same file are focused, then the last one wins, in
document order.
This attribute is provided as a way for developers to temporarily focus on a single test.
Test files with a focused test should not be checked in. For this reason,
using this attribute produces a warning.
</documentation>
</annotation>
</attribute>
</complexType>

<complexType name="codeFragmentType">
<simpleContent>
<extension base="string">
<attribute name="id" type="ID" use="required"/>
</extension>
</simpleContent>
</complexType>
</schema>
9 changes: 6 additions & 3 deletions schema/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ title: PMD Schema

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

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

**Current Version:** 1.0.0
**Current Version:** 1.1.0

**Last Change:** 2022-07-22
**Last Change:** 2025-06-22

**Documentation:** [Testing your rules](https://docs.pmd-code.org/latest/pmd_userdocs_extending_testing.html#test-xml-reference)

**Old Versions:**
* [1.0.0 (2022-07-22)](https://pmd.github.io/schema/rule-tests_1_0_0.xsd)
3 changes: 2 additions & 1 deletion schema/rule-tests_1_0_0.xsd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0.0 -->
<!-- Last change: 2022-07-22 -->
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
Expand Down Expand Up @@ -109,5 +111,4 @@
</extension>
</simpleContent>
</complexType>

</schema>
133 changes: 133 additions & 0 deletions schema/rule-tests_1_1_0.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.1.0 -->
<!-- Last change: 2025-06-22 -->
<!-- Changes against 1.0.0: expected-suppression -->
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://pmd.sourceforge.net/rule-tests"
targetNamespace="http://pmd.sourceforge.net/rule-tests"
elementFormDefault="qualified">

<element name="test-data">
<complexType>
<choice maxOccurs="unbounded">
<element name="test-code" minOccurs="0" maxOccurs="unbounded" type="tns:testType"/>
<element name="code-fragment" minOccurs="0" maxOccurs="unbounded" type="tns:codeFragmentType">
<annotation>
<documentation>
A code fragment that can be referred to by several tests.
</documentation>
</annotation>
</element>
</choice>
</complexType>
</element>

<complexType name="testType">
<sequence>
<element name="description" type="string"/>
<element name="rule-property" minOccurs="0" maxOccurs="unbounded">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name" type="string" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>

<element name="expected-problems" type="nonNegativeInteger"/>
<element name="expected-linenumbers" type="string" minOccurs="0"/>
<element name="expected-messages" minOccurs="0">
<complexType>
<sequence>
<element name="message" type="string" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="expected-suppressions" minOccurs="0">
<annotation>
<documentation>Declares the expected suppressed violations. Since PMD 7.15.0 / rule-tests 1.1.0.</documentation>
</annotation>
<complexType>
<sequence>
<element name="suppressor" maxOccurs="unbounded">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="line" type="positiveInteger" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
</complexType>
</element>
<choice>
<element name="code" type="string"/>
<element name="code-ref">
<complexType>
<attribute name="id" type="IDREF" use="required"/>
</complexType>
</element>
</choice>
<element name="source-type" minOccurs="0" default="" type="string">
<annotation>
<documentation>
Language version of the source, eg 'java 8'.
</documentation>
</annotation>
</element>
</sequence>
<attribute name="reinitializeRule" type="boolean" default="true">
<annotation>
<documentation>
This attribute is deprecated, it is assumed true and ignored.
</documentation>
</annotation>
</attribute>
<attribute name="regressionTest" type="boolean" default="true">
<annotation>
<documentation>
This attribute is deprecated. Use "disabled" instead.
If this attribute is set to "false", then the test is ignored.
</documentation>
</annotation>
</attribute>
<attribute name="useAuxClasspath" type="boolean" default="true">
<annotation>
<documentation>
This attribute is deprecated, it is assumed true and ignored.
</documentation>
</annotation>
</attribute>

<attribute name="disabled" type="boolean" default="false">
<annotation>
<documentation>
A reason why the test is disabled/ignored should be provided as a comment for the test.
</documentation>
</annotation>
</attribute>
<attribute name="focused" type="boolean" default="false">
<annotation>
<documentation>
If true, only this test will be executed, and all others will be disabled.
If several tests in the same file are focused, then the last one wins, in
document order.
This attribute is provided as a way for developers to temporarily focus on a single test.
Test files with a focused test should not be checked in. For this reason,
using this attribute produces a warning.
</documentation>
</annotation>
</attribute>
</complexType>

<complexType name="codeFragmentType">
<simpleContent>
<extension base="string">
<attribute name="id" type="ID" use="required"/>
</extension>
</simpleContent>
</complexType>
</schema>