forked from phoedos/pmd
pmd: fixed #1046 ant task CPDTask doesn't accept ecmascript
This commit is contained in:
parent
98b903897e
commit
26fa85a9fa
@ -10,6 +10,7 @@ Fixed bug 1037: Facing a showstopper issue in PMD Report Class (report listeners
|
||||
Fixed bug 1039: pmd-nicerhtml.xsl is packaged in wrong location
|
||||
Fixed bug 1043: node.getEndLine() always returns 0 (ECMAscript)
|
||||
Fixed bug 1044: Unknown option: -excludemarker
|
||||
Fixed bug 1046: ant task CPDTask doesn't accept ecmascript
|
||||
Fixed bug 1047: False Positive in 'for' loops for LocalVariableCouldBeFinal in 5.0.1
|
||||
Fixed bug 1048: CommentContent Rule, String Index out of range Exception
|
||||
Fixed bug 1055: Please add a colon in the ant output after line,column for Oracle JDeveloper IDE usage
|
||||
|
@ -188,16 +188,9 @@ public class CPDTask extends Task {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME Can't we do something cleaner and
|
||||
* more dynamic ? Maybe externalise to a properties files that will
|
||||
* be generated when building pmd ? This will not have to add manually
|
||||
* new language here ?
|
||||
*/
|
||||
public static class LanguageAttribute extends EnumeratedAttribute {
|
||||
private static final String[] LANGUAGES = new String[]{"java","jsp","cpp", "c","php", "ruby", "fortran", "cs"};
|
||||
public String[] getValues() {
|
||||
return LANGUAGES;
|
||||
return LanguageFactory.supportedLanguages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,19 +106,22 @@ public class GUI implements CPDListener {
|
||||
{"Fortran", new LanguageConfig() {
|
||||
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage("fortran"); }
|
||||
public String[] extensions() { return new String[] {".rb" }; }; } },
|
||||
{"by extension...", new LanguageConfig() {
|
||||
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage(LanguageFactory.BY_EXTENSION, p); }
|
||||
public String[] extensions() { return new String[] {"" }; }; } },
|
||||
{"PHP", new LanguageConfig() {
|
||||
{"PHP", new LanguageConfig() {
|
||||
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage("php"); }
|
||||
public String[] extensions() { return new String[] {".php" }; }; } },
|
||||
{"C#", new LanguageConfig() {
|
||||
{"C#", new LanguageConfig() {
|
||||
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage("cs"); }
|
||||
public String[] extensions() { return new String[] {".cs" }; }; } },
|
||||
{"Ecmascript", new LanguageConfig() {
|
||||
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage("js"); }
|
||||
public String[] extensions() { return new String[] {".js" }; }; } },
|
||||
{"by extension...", new LanguageConfig() {
|
||||
public Language languageFor(LanguageFactory lf, Properties p) { return lf.createLanguage(LanguageFactory.BY_EXTENSION, p); }
|
||||
public String[] extensions() { return new String[] {"" }; }; } },
|
||||
};
|
||||
|
||||
private static final int DEFAULT_CPD_MINIMUM_LENGTH = 75;
|
||||
private static final Map LANGUAGE_CONFIGS_BY_LABEL = new HashMap(LANGUAGE_SETS.length);
|
||||
private static final Map<String, LanguageConfig> LANGUAGE_CONFIGS_BY_LABEL = new HashMap<String, LanguageConfig>(LANGUAGE_SETS.length);
|
||||
private static final KeyStroke COPY_KEY_STROKE = KeyStroke.getKeyStroke(KeyEvent.VK_C,ActionEvent.CTRL_MASK,false);
|
||||
private static final KeyStroke DELETE_KEY_STROKE = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0);
|
||||
|
||||
@ -148,12 +151,12 @@ public class GUI implements CPDListener {
|
||||
|
||||
static {
|
||||
for (int i=0; i<LANGUAGE_SETS.length; i++) {
|
||||
LANGUAGE_CONFIGS_BY_LABEL.put(LANGUAGE_SETS[i][0], LANGUAGE_SETS[i][1]);
|
||||
LANGUAGE_CONFIGS_BY_LABEL.put((String)LANGUAGE_SETS[i][0], (LanguageConfig)LANGUAGE_SETS[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
private static LanguageConfig languageConfigFor(String label) {
|
||||
return (LanguageConfig)LANGUAGE_CONFIGS_BY_LABEL.get(label);
|
||||
return LANGUAGE_CONFIGS_BY_LABEL.get(label);
|
||||
}
|
||||
|
||||
private static class CancelListener implements ActionListener {
|
||||
|
@ -7,9 +7,16 @@ import java.util.Properties;
|
||||
|
||||
public class LanguageFactory {
|
||||
|
||||
// TODO derive and provide this at runtime instead, used by outside IDEs
|
||||
public static String[] supportedLanguages = new String[]{"java", "jsp", "cpp", "c", "php", "ruby","fortran", "ecmascript","cs" };
|
||||
|
||||
/*
|
||||
* TODO derive and provide this at runtime instead, used by outside IDEs
|
||||
* FIXME Can't we do something cleaner and
|
||||
* more dynamic ? Maybe externalise to a properties files that will
|
||||
* be generated when building pmd ? This will not have to add manually
|
||||
* new language here ?
|
||||
*/
|
||||
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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user