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:
7
pmd-eclipse-test-fragment/.classpath
Normal file
7
pmd-eclipse-test-fragment/.classpath
Normal 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>
|
28
pmd-eclipse-test-fragment/.project
Normal file
28
pmd-eclipse-test-fragment/.project
Normal 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>
|
4
pmd-eclipse-test-fragment/build.properties
Normal file
4
pmd-eclipse-test-fragment/build.properties
Normal 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
|
18
pmd-eclipse-test-fragment/fragment.xml
Normal file
18
pmd-eclipse-test-fragment/fragment.xml
Normal 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>
|
2
pmd-eclipse-test-fragment/src/rulesets/additional
Normal file
2
pmd-eclipse-test-fragment/src/rulesets/additional
Normal file
@ -0,0 +1,2 @@
|
||||
rulesets/extra1.xml
|
||||
rulesets/extra2.xml
|
616
pmd-eclipse-test-fragment/src/rulesets/extra1.xml
Normal file
616
pmd-eclipse-test-fragment/src/rulesets/extra1.xml
Normal file
File diff suppressed because it is too large
Load Diff
129
pmd-eclipse-test-fragment/src/rulesets/extra2.xml
Normal file
129
pmd-eclipse-test-fragment/src/rulesets/extra2.xml
Normal 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>
|
Reference in New Issue
Block a user