Tweaked JSP/JSF rule docs

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4316 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2006-03-29 15:24:34 +00:00
parent 3f47af4d21
commit 7a983f2e51
6 changed files with 61 additions and 43 deletions

View File

@ -57,7 +57,7 @@ rm -rf tmp/
mkdir tmp
cd tmp
cvs -q export -r pmd_release_3_6 pmd
mv pmd/ pmd-3.6/
mv pmd/ pmd-3.6
cd ..
cp pmd/lib/pmd-src-3.6.jar tmp/pmd-3.6/lib/
mv tmp/pmd-3.6/ ~/tmp/

View File

@ -15,7 +15,7 @@
<x:expr select="@name"/>
</j:set>
<properties>
<author email="tom@infoether.org">Tom Copeland</author>
<author email="tom@infoether.com">Tom Copeland</author>
<title>Rule Set: ${rulesetname}</title>
</properties>
<body>

View File

@ -59,7 +59,7 @@
<version>
<id>3.6</id>
<name>3.6</name>
<tag>pmd_release_3_5</tag>
<tag>pmd_release_3_6</tag>
</version>
<version>
<id>dev</id>

View File

@ -1,34 +1,40 @@
<?xml version="1.0"?>
<ruleset name="Basic JSF rules" language="jsp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Rules concerning basic JSF guidelines.</description>
<rule name="DontNestJsfInJstlIteration"
message="Do not nest JSF component custom actions inside a custom action that iterates over its body."
class="net.sourceforge.pmd.rules.XPathRule">
<description>Do not nest JSF component custom actions inside a custom action that iterates over its body.</description>
<priority>3</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//Element[ @Name="c:forEach" ] // Element[ @NamespacePrefix="h" or @NamespacePrefix="f" ]
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
<html> <body> <ul>
<ruleset name="Basic JSF rules"
language="jsp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Rules concerning basic JSF guidelines.
</description>
<rule name="DontNestJsfInJstlIteration"
message="Do not nest JSF component custom actions inside a custom action that iterates over its body."
class="net.sourceforge.pmd.rules.XPathRule"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsf.html#DontNestJsfInJstlIteration">
<description>
Do not nest JSF component custom actions inside a custom action that iterates over its body.
</description>
<properties>
<property name="xpath">
<value>
<![CDATA[
//Element[ @Name="c:forEach" ] // Element[ @NamespacePrefix="h" or @NamespacePrefix="f" ]
]]>
</value>
</property>
</properties>
<priority>3</priority>
<example>
<![CDATA[
<html> <body> <ul>
<c:forEach items='${books}' var='b'>
<li> <h:outputText value='#{b}' /> </li>
</c:forEach>
</c:forEach>
</ul> </body> </html>
]]>
</example>
</rule>
]]>
</example>
</rule>
</ruleset>

View File

@ -1,14 +1,16 @@
<?xml version="1.0"?>
<ruleset name="Basic JSP rules" language="jsp"
<ruleset name="Basic JSP rules"
language="jsp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://pmd.sf.net/ruleset_xml_schema.xsd">
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Rules concerning basic JSP guidelines.</description>
<rule name="NoLongScripts"
message="Avoid having long scripts (e.g. Javascript) inside a JSP file."
class="net.sourceforge.pmd.rules.XPathRule">
class="net.sourceforge.pmd.rules.XPathRule"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsp.html#NoLongScripts">
<description> Scripts should be part of Tag Libraries, rather than part of JSP pages.
</description>
<priority>2</priority>
@ -48,8 +50,10 @@ onload=calcDays;
</example>
</rule>
<rule name="NoScriptlets" message="Avoid having scriptlets inside a JSP file."
class="net.sourceforge.pmd.rules.XPathRule">
<rule name="NoScriptlets"
message="Avoid having scriptlets inside a JSP file."
class="net.sourceforge.pmd.rules.XPathRule"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsp.html#NoScriptlets">
<description> Scriptlets should be factored into Tag Libraries or JSP declarations,
rather than being part of JSP pages. </description>
<priority>3</priority>
@ -78,8 +82,10 @@ response.setHeader("Pragma", "No-cache");
</example>
</rule>
<rule name="NoInlineStyleInformation" message="Avoid having style information in JSP files."
class="net.sourceforge.pmd.jsp.rules.NoInlineStyleInformation">
<rule name="NoInlineStyleInformation"
message="Avoid having style information in JSP files."
class="net.sourceforge.pmd.jsp.rules.NoInlineStyleInformation"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsp.html#NoInlineStyleInformation">
<description><![CDATA[ Style information should be put in CSS files, not in JSPs.
Therefore, don't use <B> or <FONT> tags, or attributes like "align='center'" ]]> </description>
<priority>3</priority>
@ -93,7 +99,8 @@ response.setHeader("Pragma", "No-cache");
<rule name="NoClassAttribute"
message="Do not use an attribute called 'class'."
class="net.sourceforge.pmd.rules.XPathRule">
class="net.sourceforge.pmd.rules.XPathRule"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsp.html#NoClassAttribute">
<description>Do not use an attribute called 'class'. Use "styleclass" for CSS styles.
</description>
<priority>2</priority>
@ -115,7 +122,8 @@ response.setHeader("Pragma", "No-cache");
<rule name="NoJspForward"
message="Do not do a forward from within a JSP file."
class="net.sourceforge.pmd.rules.XPathRule">
class="net.sourceforge.pmd.rules.XPathRule"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsp.html#NoJspForward">
<description>Do not do a forward from within a JSP file.
</description>
<priority>3</priority>
@ -135,7 +143,8 @@ response.setHeader("Pragma", "No-cache");
<rule name="IframeMissingSrcAttribute"
message="IFrames must have a src attribute."
class="net.sourceforge.pmd.rules.XPathRule">
class="net.sourceforge.pmd.rules.XPathRule"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsp.html#IframeMissingSrcAttribute">
<description>
IFrames which are missing a src element can cause security information popups
in IE if you are accessing the page through SSL. See http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q261188
@ -165,7 +174,8 @@ response.setHeader("Pragma", "No-cache");
<rule name="NoHtmlComments"
message="Use JSP comments instead of HTML comments"
class="net.sourceforge.pmd.rules.XPathRule">
class="net.sourceforge.pmd.rules.XPathRule"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic-jsp.html#NoHtmlComments">
<description>
In a production system, HTML comments increase the payload between the application
server to the client, and serve little other purpose. Consider switching to

View File

@ -15,8 +15,8 @@
href="http://sourceforge.net" />
</links>
<menu name="Overview">
<item name="Download PMD 3.6" href="http://sourceforge.net/project/showfiles.php?group_id=56262&amp;package_id=51441" />
<item name="What's new in PMD 3.6" href="http://sourceforge.net/project/shownotes.php?release_id=388238&amp;group_id=56262" />
<item name="Download PMD 3.6" href="http://sourceforge.net/project/showfiles.php?group_id=56262&amp;package_id=51441&amp;release_id=405661" />
<item name="What's new in PMD 3.6" href="http://sourceforge.net/project/shownotes.php?release_id=405661&amp;group_id=56262" />
<item name="PMD in the news" href="/news.html" />
<item name="PMD-related products and books" href="/products.html" />
<item name="Best practices" href="/bestpractices.html" />
@ -68,6 +68,8 @@
<item name="Strings" href="/rules/strings.html" />
<item name="Sun Security" href="/rules/sunsecure.html" />
<item name="Unused Code" href="/rules/unusedcode.html" />
<item name="Java Server Pages" href="/rules/basic-jsp.html" />
<item name="Java Server Faces" href="/rules/basic-jsf.html" />
</menu>
</body>
</project>