applied patch 2996539 : Add support for C# to CPD (simple parser)

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7328 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Romain Pelisse
2011-09-24 00:30:19 +00:00
parent 32bbd35037
commit 85cc2b5a10
6 changed files with 12 additions and 5 deletions

View File

@ -19,7 +19,7 @@ usage() {
}
supported_languages() {
echo "c, cpp, fortran, java, jsp, php, ruby"
echo "c, cpp, fortran, java, jsp, php, ruby,cs"
}
is_cygwin() {
@ -56,7 +56,7 @@ cygwin_paths() {
language_settings() {
readonly LANGUAGE=${LANGUAGE:-cpp}
case "${LANGUAGE}" in
c|cpp|fortran|java|jsp|php|ruby)
c|cs|cpp|fortran|java|jsp|php|ruby)
echo "Language is set to ${LANGUAGE}"
;;
*)

View File

@ -320,8 +320,11 @@ XPathRules can now query using XPath 2.0 with 'version=2.0"', or XPath 2.0 in XP
Rules can now use property values in messages, for example ${propertyName} will expand to the value of the 'propertyName' property on the Rule.
Rules can now use violation specific values in messages, specifically ${variableName}, ${methodName}, ${className}, ${packageName}.
New XPath function 'getCommentOn' can be used to search for strings in comments - Thanks to Andy Throgmorton
CPD:
Add .hxx and .hpp as valid file extension for CPD - Thanks to Ryan Pavlik
Add options to to the CPD command line task - Thanks to Cd-Man
Add C# support for CPD - thanks to Florian Bauer
Other changes:
Rule property API upgrades:

View File

@ -185,7 +185,7 @@ public class CPDTask extends Task {
* new language here ?
*/
public static class LanguageAttribute extends EnumeratedAttribute {
private static final String[] LANGUAGES = new String[]{"java","jsp","cpp", "c","php", "ruby", "fortran"};
private static final String[] LANGUAGES = new String[]{"java","jsp","cpp", "c","php", "ruby", "fortran", "cs"};
public String[] getValues() {
return LANGUAGES;
}

View File

@ -113,6 +113,10 @@ public class GUI implements CPDListener {
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage("php"); }
public boolean ignoreLiteralsByDefault() { return false; }
public String[] extensions() { return new String[] {".php" }; }; } },
{"C#", new LanguageConfig() {
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage("cs"); }
public boolean ignoreLiteralsByDefault() { return false; }
public String[] extensions() { return new String[] {".cs" }; }; } },
};
private static final int DEFAULT_CPD_MINIMUM_LENGTH = 75;

View File

@ -7,7 +7,7 @@ import java.util.Properties;
public class LanguageFactory {
public static String[] supportedLanguages = new String[]{"java", "jsp", "cpp", "c", "php", "ruby","fortran", "ecmascript" };
public static String[] supportedLanguages = new String[]{"java", "jsp", "cpp", "c", "php", "ruby","fortran", "ecmascript","cs" };
private static final String SUFFIX = "Language";
public static final String EXTENSION = "extension";
public static final String BY_EXTENSION = "by_extension";

View File

@ -76,7 +76,7 @@
</tr>
<tr>
<td valign="top">language</td>
<td valign="top">Flag to select the appropriate language (e.g. <code>cpp</code>, <code>java</code>, <code>php</code>, <code>ruby</code>); defaults to <code>java</code>.</td>
<td valign="top">Flag to select the appropriate language (e.g. <code>cpp</code>, <code>cs</code> <code>java</code>, <code>php</code>, <code>ruby</code>, and <code>ecmascript</code>); defaults to <code>java</code>.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>