Removed the old implementation of the package name check.
This commit is contained in:
parent
ba942fa395
commit
f32694566e
|
|
@ -73,12 +73,6 @@ public class Configuration
|
|||
PATTERN_DEFAULTS.put(Defn.LOCAL_FINAL_VAR_PATTERN_PROP,
|
||||
"^[a-z][a-zA-Z0-9]*$");
|
||||
PATTERN_DEFAULTS.put(Defn.IGNORE_LINE_LENGTH_PATTERN_PROP, "^$");
|
||||
|
||||
// Uppercase letters seem rather uncommon, but they're allowed in
|
||||
// http://java.sun.com/docs/books/jls/
|
||||
// second_edition/html/packages.doc.html#40169
|
||||
PATTERN_DEFAULTS.put(Defn.PACKAGE_PATTERN_PROP,
|
||||
"^[a-z]+(\\.[a-zA-Z_][a-zA-Z_0-9]*)*$");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -394,18 +388,6 @@ public class Configuration
|
|||
return getRegexpProperty(Defn.TODO_PATTERN_PROP);
|
||||
}
|
||||
|
||||
/** @return pattern to match package names **/
|
||||
public String getPackagePat()
|
||||
{
|
||||
return getPatternProperty(Defn.PACKAGE_PATTERN_PROP);
|
||||
}
|
||||
|
||||
/** @return regexp to match package names **/
|
||||
public RE getPackageRegexp()
|
||||
{
|
||||
return getRegexpProperty(Defn.PACKAGE_PATTERN_PROP);
|
||||
}
|
||||
|
||||
/** @return pattern to match static variables **/
|
||||
String getStaticPat()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ public interface Defn
|
|||
String LOCAL_VAR_PATTERN_PROP = "checkstyle.pattern.localvar";
|
||||
/** property name for the method local final variable pattern **/
|
||||
String LOCAL_FINAL_VAR_PATTERN_PROP = "checkstyle.pattern.localfinalvar";
|
||||
/** property name for the package name pattern **/
|
||||
String PACKAGE_PATTERN_PROP = "checkstyle.pattern.package";
|
||||
/** property name for the maximum line length **/
|
||||
String MAX_LINE_LENGTH_PROP = "checkstyle.maxlinelen";
|
||||
/** property name for length of methods **/
|
||||
|
|
@ -156,7 +154,6 @@ public interface Defn
|
|||
CONST_PATTERN_PROP,
|
||||
MEMBER_PATTERN_PROP,
|
||||
PUBLIC_MEMBER_PATTERN_PROP,
|
||||
PACKAGE_PATTERN_PROP,
|
||||
LOCAL_VAR_PATTERN_PROP,
|
||||
LOCAL_FINAL_VAR_PATTERN_PROP,
|
||||
IGNORE_LINE_LENGTH_PATTERN_PROP,
|
||||
|
|
|
|||
|
|
@ -848,7 +848,6 @@ class Verifier
|
|||
void reportPackageName(LineText aName)
|
||||
{
|
||||
mPkgName = aName.getText();
|
||||
checkPackageName(aName);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1128,21 +1127,6 @@ class Verifier
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verify that a package name conforms to the style.
|
||||
* @param aName the package name
|
||||
**/
|
||||
private void checkPackageName(LineText aName)
|
||||
{
|
||||
RE packageRegexp = mConfig.getPackageRegexp();
|
||||
if (!packageRegexp.match(aName.getText())) {
|
||||
mMessages.add(aName.getLineNo(), aName.getColumnNo(),
|
||||
"name.invalidPattern",
|
||||
aName.getText(), mConfig.getPackagePat());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the specified C comment as a String array.
|
||||
* @return C comment as a array
|
||||
|
|
|
|||
|
|
@ -472,7 +472,6 @@ public class CheckerTest
|
|||
"^.*is OK.*regexp.*$");
|
||||
mProps.setProperty(Defn.TODO_PATTERN_PROP, "FIXME:");
|
||||
mProps.setProperty(Defn.MEMBER_PATTERN_PROP, "^m[A-Z][a-zA-Z0-9]*$");
|
||||
mProps.setProperty(Defn.PACKAGE_PATTERN_PROP, "[A-Z]+");
|
||||
mProps.setProperty(Defn.LOCAL_FINAL_VAR_PATTERN_PROP, "[A-Z]+");
|
||||
final Checker c = createChecker();
|
||||
final String filepath = getPath("InputSimple.java");
|
||||
|
|
@ -480,7 +479,6 @@ public class CheckerTest
|
|||
final String[] expected = {
|
||||
filepath + ":1: File length is 198 lines (max allowed is 20).",
|
||||
filepath + ":3: Line does not match expected header line of '// Created: 2001'.",
|
||||
filepath + ":6:10: Name 'com.puppycrawl.tools.checkstyle' must match pattern '[A-Z]+'.",
|
||||
filepath + ":18: Line is longer than 80 characters.",
|
||||
filepath + ":19:25: Line contains a tab character.",
|
||||
filepath + ":25:29: Name 'badConstant' must match pattern '^[A-Z](_?[A-Z0-9]+)*$'.",
|
||||
|
|
|
|||
Loading…
Reference in New Issue