Added new ClassNamingConventionsRule, thanks to Jeff Anderson for the code

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2036 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-06-25 14:49:08 +00:00
parent 3493a2d210
commit 14108566ef
9 changed files with 34 additions and 23 deletions

View File

@ -1,5 +1,5 @@
???? - 1.11:
Added new rules: VariableNamingConventionsRule, MethodNamingConventionsRule
Added new rules: VariableNamingConventionsRule, MethodNamingConventionsRule, ClassNamingConventionsRule
Fixed bug 583047 - columns were wrong on ASTName nodes
ASTViewer now shows node images and modifiers
ASTViewer now saves last edited text to ~/.pmd_astviewer

View File

@ -1,8 +1,7 @@
package test.net.sourceforge.pmd.rules;
import net.sourceforge.pmd.rules.VariableNamingConventionsRule;
import net.sourceforge.pmd.rules.MethodNamingConventionsRule;
import net.sourceforge.pmd.cpd.CPD;
import net.sourceforge.pmd.rules.MethodNamingConventionsRule;
public class MethodNamingConventionsRuleTest extends SimpleAggregatorTst {

View File

@ -44,6 +44,18 @@ public class Foo {
</rule>
<rule name="ClassNamingConventionsRule"
message="Class names should begin with an uppercase character and not include underscores"
class="net.sourceforge.pmd.rules.ClassNamingConventionsRule">
<description> Class names should always begin with an upper case character, and should not contain underscores.
</description>
<priority>1</priority>
<example>
<![CDATA[
public class Foo {}
]]>
</example>
</rule>
</ruleset>

View File

@ -22,8 +22,8 @@ import java.awt.FileDialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
public class GUI implements CPDListener {

View File

@ -1,11 +1,10 @@
package net.sourceforge.pmd.renderers;
import java.util.Iterator;
import net.sourceforge.pmd.Report;
import net.sourceforge.pmd.RuleViolation;
import net.sourceforge.pmd.cpd.CPD;
import net.sourceforge.pmd.renderers.Renderer;
import java.util.Iterator;
/**
* @version $Revision$ $Date$

View File

@ -1,7 +1,8 @@
package net.sourceforge.pmd.rules;
import net.sourceforge.pmd.*;
import net.sourceforge.pmd.ast.*;
import net.sourceforge.pmd.AbstractRule;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.ast.ASTMethodDeclarator;
public class MethodNamingConventionsRule extends AbstractRule {

View File

@ -1,16 +1,16 @@
package net.sourceforge.pmd.rules;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.AbstractRule;
import net.sourceforge.pmd.ast.ASTVariableDeclaratorId;
import net.sourceforge.pmd.ast.ASTVariableDeclarator;
import net.sourceforge.pmd.ast.ASTPrimitiveType;
import net.sourceforge.pmd.ast.ASTName;
import net.sourceforge.pmd.ast.ASTType;
import net.sourceforge.pmd.ast.AccessNode;
import net.sourceforge.pmd.ast.Node;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.ast.ASTFieldDeclaration;
import net.sourceforge.pmd.ast.ASTLocalVariableDeclaration;
import net.sourceforge.pmd.ast.ASTName;
import net.sourceforge.pmd.ast.ASTPrimitiveType;
import net.sourceforge.pmd.ast.ASTType;
import net.sourceforge.pmd.ast.ASTVariableDeclarator;
import net.sourceforge.pmd.ast.ASTVariableDeclaratorId;
import net.sourceforge.pmd.ast.AccessNode;
import net.sourceforge.pmd.ast.Node;
public class VariableNamingConventionsRule extends AbstractRule {

View File

@ -26,13 +26,13 @@ import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.io.StringReader;
import java.io.IOException;
import java.io.File;
import java.io.FileWriter;
import java.io.FileReader;
import java.io.BufferedReader;
import java.util.Iterator;
public class ASTViewer {

View File

@ -10,7 +10,7 @@
<section name="Credits">
<subsection name="Individuals">
<ul>
<li>Jeff Anderson - VariableNamingConventionsRule, MethodNamingConventionsRule</li>
<li>Jeff Anderson - VariableNamingConventionsRule, MethodNamingConventionsRule, ClassNamingConventionsRule</li>
<li>Frank van Puffelen - documentation suggestions</li>
<li>Conrad Roche - bug report</li>
<li>mcclain looney - patch for CPD GUI, bug reports</li>