Adding noinlinestyles rule
This commit is contained in:
1 parent
3a96e8ada3
commit
7ee2493593
3 files changed
+38
-3
No files matched your search
@@ -89,17 +89,26 @@ Avoid unused macro parameters. They should be deleted.
|
||||
<description>
|
||||
Avoid inline JavaScript. Import .js files instead.
|
||||
</description>
|
||||
<priority>2</priority><!--
|
||||
<priority>2</priority>
|
||||
</rule>
|
||||
|
||||
<rule name="NoInlineStyles"
|
||||
since="5.1"
|
||||
message="Avoid inline styles" language="vm"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule">
|
||||
<description>
|
||||
Avoid inline styles. Use css classes instead.
|
||||
</description>
|
||||
<priority>2</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//Text[matches(@literal, "<[Ss][Cc][Rr][Ii][Pp][Tt]\s[^>]*([sS][rR][cC]){0}+")]
|
||||
//Text[matches(@literal, "<[^>]+\s[sS][tT][yY][lL][eE]\s*=")]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
</properties>
|
||||
-->
|
||||
</rule>
|
||||
|
||||
</ruleset>
|
||||
|
||||
@@ -18,6 +18,7 @@ public class BasicRulesTest extends SimpleAggregatorTst {
|
||||
addRule(RULESET, "EmptyForeachStmtRule");
|
||||
addRule(RULESET, "UnusedMacroParameter");
|
||||
addRule(RULESET, "NoInlineJavaScript");
|
||||
addRule(RULESET, "NoInlineStyles");
|
||||
}
|
||||
|
||||
public static junit.framework.Test suite() {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<test-data>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Bad example #1
|
||||
]]></description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
<h2 style = "color=blue;">text</h2>
|
||||
]]></code>
|
||||
<source-type>vm</source-type>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Good example #1
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
There is nothing here
|
||||
]]></code>
|
||||
<source-type>vm</source-type>
|
||||
</test-code>
|
||||
|
||||
</test-data>
|
||||
Reference in new issue
Block a user