Create a plugin fragment for the Eclipse plugin unit tests

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3587 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Philippe Herlin
2005-06-15 21:16:27 +00:00
parent 85ca507481
commit 45030e0743
7 changed files with 804 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>pmd-eclipse-test-fragment</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
source.pmd_eclipse_test_fragment.jar = src/
output.pmd_eclipse_test_fragment.jar = bin/
bin.includes = fragment.xml,\
pmd_eclipse_test_fragment.jar

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<fragment
id="pmd_eclipse_test_fragment"
name="Pmd_eclipse_test_fragment Fragment"
version="1.0.0"
provider-name=""
plugin-id="net.sourceforge.pmd.core"
plugin-version="3.1.0"
match="greaterOrEqual">
<runtime>
<library name="pmd_eclipse_test_fragment.jar">
<export name="*"/>
</library>
</runtime>
</fragment>

View File

@ -0,0 +1,2 @@
rulesets/extra1.xml
rulesets/extra2.xml

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,129 @@
<?xml version="1.0"?>
<ruleset name="Extra Rules 2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../etc/ruleset_xml_schema.xml">
<description>
The Braces Ruleset contains a collection of braces rules.
</description>
<rule name="IfStmtsMustUseBraces"
message="Avoid using if statements without curly braces"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Avoid using if statements without using curly braces
</description>
<properties>
<property name="xpath">
<value>
<![CDATA[
//IfStatement[count(*) < 3][not(Statement/Block)]
]]>
</value>
</property>
</properties>
<priority>3</priority>
<example>
<![CDATA[
public class Foo {
public void bar() {
int x = 0;
if (foo) x++;
}
}
]]>
</example>
</rule>
<rule name="WhileLoopsMustUseBraces"
message="Avoid using 'while' statements without curly braces"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Avoid using 'while' statements without using curly braces
</description>
<properties>
<property name="xpath">
<value>
<![CDATA[
//WhileStatement[not(Statement/Block)]
]]>
</value>
</property>
</properties>
<priority>3</priority>
<example>
<![CDATA[
public void doSomething() {
while (true)
x++;
}
]]>
</example>
</rule>
<rule name="IfElseStmtsMustUseBraces"
message="Avoid using 'if...else' statements without curly braces"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Avoid using if..else statements without using curly braces
</description>
<properties>
<property name="xpath">
<value>
<![CDATA[
//Statement
[parent::IfStatement[@Else='true']]
[not(child::Block)]
[not(child::IfStatement)]
]]>
</value>
</property>
</properties>
<priority>3</priority>
<example>
<![CDATA[
public void doSomething() {
// this is OK
if (foo) x++;
// but this is not
if (foo)
x=x+1;
else
x=x-1;
}
]]>
</example>
</rule>
<rule name="ForLoopsMustUseBraces"
message="Avoid using 'for' statements without curly braces"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Avoid using 'for' statements without using curly braces
</description>
<properties>
<property name="xpath">
<value>
<![CDATA[
//ForStatement[not(Statement/Block)]
]]>
</value>
</property>
</properties>
<priority>3</priority>
<example>
<![CDATA[
public void foo() {
for (int i=0; i<42;i++)
foo();
}
]]>
</example>
</rule>
</ruleset>