|
From: <caw...@us...> - 2007-05-17 16:05:45
|
Revision: 2498
http://svn.sourceforge.net/rubyeclipse/?rev=2498&view=rev
Author: cawilliams
Date: 2007-05-17 09:05:38 -0700 (Thu, 17 May 2007)
Log Message:
-----------
ignore case where variables are close but one is just a plural of the other (we just simplify that case to an 's' being added at the end).
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java 2007-05-17 15:55:56 UTC (rev 2497)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java 2007-05-17 16:05:38 UTC (rev 2498)
@@ -108,6 +108,11 @@
} else { // name is local var
if (isInstanceVar(string) || isClassVar(string))
continue;
+ }
+ if (isPlural(modName, string) || isPlural(string, modName)) {
+ // check for one being plural of other, if so skip them
+ // FIXME Make this option configurable!
+ continue;
}
if (damerauLevenshteinDistance(modName, string) <= levenshteinThreshold(modName)) {
createProblem(map.get(name).getPosition(),
@@ -117,6 +122,11 @@
}
}
+ private boolean isPlural(String singular, String plural) {
+ return (singular.length() == plural.length() - 1) && (singular.equals(plural.substring(0, plural.length() - 1))) &&
+ plural.charAt(plural.length() - 1) == 's';
+ }
+
private boolean isInstanceVar(String name) {
return !isClassVar(name) && name.startsWith("@");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|