<?xml version="1.0"?>

<ruleset name="Basic Velocity"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">

  <description>
	The Basic Velocity ruleset contains basic rules for Apache Velocity pages.
  </description>
  
  <rule name="AvoidDeeplyNestedIfStmts"
  		  since="5.1"
        message="Deeply nested if..then statements are hard to read"
        class="net.sourceforge.pmd.lang.vm.rule.basic.AvoidDeeplyNestedIfStmtsRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#AvoidDeeplyNestedIfStmts">
    <description>
	Avoid creating deeply nested if-then statements since they are harder to read and error-prone to maintain.
    </description>
      <priority>3</priority>
    </rule>
  
    <rule name="CollapsibleIfStatements"
          since="5.1"
          message="These nested if statements could be combined"
          class="net.sourceforge.pmd.lang.vm.rule.basic.CollapsibleIfStatementsRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#CollapsibleIfStatements">
      <description>
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
      </description>
      <priority>3</priority>
    </rule>
  
    <rule name="ExcessiveTemplateLength"
          since="5.1"
          message="Template is too long"
          class="net.sourceforge.pmd.lang.vm.rule.basic.ExcessiveTemplateLengthRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#ExcessiveTemplateLength">
      <description>
The template is too long. It should be broken up into smaller pieces.
      </description>
      <priority>3</priority>
      <properties>
      	<property name="minimum" value="1000"/>
      </properties>
    </rule>
  
    <rule name="AvoidReassigningParameters"
    	  since="5.1"
        message="Avoid reassigning macro parameters such as ''{0}''"
        class="net.sourceforge.pmd.lang.vm.rule.basic.AvoidReassigningParametersRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#AvoidReassigningParameters">
	    <description>
Reassigning values to incoming parameters is not recommended.  Use temporary local variables instead.
	    </description>
	    <priority>2</priority>
	</rule>
	
    <rule name="EmptyIfStmt"
    	  since="5.1"
        message="Avoid empty if statements"
        class="net.sourceforge.pmd.lang.vm.rule.basic.EmptyIfStmtRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#EmptyIfStmt">
	    <description>
Empty if statements should be deleted.
	    </description>
	    <priority>2</priority>
	</rule>
	
    <rule name="EmptyForeachStmt"
    	  since="5.1"
        message="Avoid empty foreach loops"
        class="net.sourceforge.pmd.lang.vm.rule.basic.EmptyForeachStmtRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#EmptyForeachStmt">
	    <description>
Empty foreach statements should be deleted.
	    </description>
	    <priority>2</priority>
	</rule>
	  
    <rule name="UnusedMacroParameter"
    	  since="5.1"
        message="Avoid unused macro parameters such as ''{0}''"
        class="net.sourceforge.pmd.lang.vm.rule.basic.UnusedMacroParameterRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#UnusedMacroParameter">
	    <description>
Avoid unused macro parameters. They should be deleted.
	    </description>
	    <priority>2</priority>
	</rule>
	
    <rule name="NoInlineJavaScript"
    	  since="5.1"
        message="Avoid inline JavaScript"
        class="net.sourceforge.pmd.lang.vm.rule.basic.NoInlineJavaScriptRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#NoInlineJavaScript">
	    <description>
Avoid inline JavaScript. Import .js files instead.
	    </description>
	    <priority>2</priority>
	</rule>
	
    <rule name="NoInlineStyles"
    	  since="5.1"
        message="Avoid inline styles" language="vm" 
        class="net.sourceforge.pmd.lang.rule.XPathRule"
        externalInfoUrl="${pmd.website.baseurl}/rules/vm/basic.html#NoInlineStyles">
	    <description>
Avoid inline styles. Use css classes instead.
	    </description>
	    <priority>2</priority>
		<properties>
			<property name="xpath">
				<value>
					<![CDATA[ 
	//Text[matches(@literal, "<[^>]+\s[sS][tT][yY][lL][eE]\s*=")]
					 ]]>
				</value>
			</property>
		</properties>
	</rule>
	  
</ruleset>
  