To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 6695ef5b authored by John Zhang's avatar John Zhang
Browse files

Though not the official fix, this enables shortname on filelists

There is a bug in PMD, see https://github.com/pmd/pmd/issues/872
This is likely properly fixed in 6.1.0.
But for 5.7.0, this custom fix should work in DaCapo's case.
parent 815a1cd6
Pipeline #1703 failed with stage
in 21 minutes and 30 seconds
......@@ -88,7 +88,7 @@ public class Pmd extends Benchmark {
public void prepare(String size) {
String [] config_args = config.getArgs(size);
args = new String[12];
args = new String[13];
args[0] = "-filelist";
args[1] = prepended_filelist(fileInScratch(config_args[0].substring(1))).getPath();
......@@ -107,13 +107,15 @@ public class Pmd extends Benchmark {
args[8] = "-failOnViolation";
args[9] = "false";
args[10] = "-rulesets";
args[10] = "-shortnames";
args[11] = "-rulesets";
List<String> rulesets = new ArrayList<String>(args.length - 2);
for (int i = 2; i < config_args.length; i ++) {
if (config_args[i].charAt(0) != '-')
rulesets.add(fileInScratch(config_args[i]));
}
args[11] = String.join(",", rulesets);
args[12] = String.join(",", rulesets);
}
public void iterate(String size) throws Exception {
......
......@@ -4,15 +4,13 @@ benchmark pmd
jars "pmd-core-5.7.0.jar", "pmd-java-5.7.0.jar", "jaxen-1.1.6.jar", "asm-5.0.4.jar", "commons-io-2.4.jar", "commons-lang3-3.4.jar", "jcommander-1.48.jar", "saxon-9.1.0.8.jar", "saxon-9.1.0.8-dom.jar", "junit-3.8.1.jar", "xercesImpl.jar", "xml-apis.jar";
size xsmall args "@pmd/small.lst","text","pmd/rulesets/java/braces.xml","-debug"
output
stdout digest 0xda39a3ee5e6b4b0d3255bfef95601890afd80709;
output
size small args "@pmd/small.lst","text",
"pmd/rulesets/java/basic.xml",
"pmd/rulesets/java/braces.xml",
"pmd/rulesets/java/codesize.xml",
"pmd/rulesets/java/controversial.xml",
"pmd/rulesets/java/coupling.xml",
"pmd/rulesets/java/design.xml",
"pmd/rulesets/java/finalizers.xml",
"pmd/rulesets/java/imports.xml",
......@@ -23,14 +21,13 @@ size small args "@pmd/small.lst","text",
"pmd/rulesets/java/strings.xml",
"pmd/rulesets/java/unusedcode.xml"
output
stdout digest 0xc3ee874f7e895457e0c486291e082277786d7bbd;
stdout digest 33e383fe2f079d7bfa76f564482c144fee1654;
size default args "@pmd/default.lst","text",
"pmd/rulesets/java/basic.xml",
"pmd/rulesets/java/braces.xml",
"pmd/rulesets/java/codesize.xml",
"pmd/rulesets/java/controversial.xml",
"pmd/rulesets/java/coupling.xml",
"pmd/rulesets/java/design.xml",
"pmd/rulesets/java/finalizers.xml",
"pmd/rulesets/java/imports.xml",
......@@ -41,14 +38,13 @@ size default args "@pmd/default.lst","text",
"pmd/rulesets/java/strings.xml",
"pmd/rulesets/java/unusedcode.xml"
output
stdout digest 0x5b442091d85eae506967ac32c08e6f1a367be712;
stdout digest 4df767dd7cb928f7a8737b673826f0db2e6bf8;
size large args "@pmd/large.lst","text",
"pmd/rulesets/java/basic.xml",
"pmd/rulesets/java/braces.xml",
"pmd/rulesets/java/codesize.xml",
"pmd/rulesets/java/controversial.xml",
"pmd/rulesets/java/coupling.xml",
"pmd/rulesets/java/design.xml",
"pmd/rulesets/java/finalizers.xml",
"pmd/rulesets/java/imports.xml",
......@@ -59,7 +55,7 @@ size large args "@pmd/large.lst","text",
"pmd/rulesets/java/strings.xml",
"pmd/rulesets/java/unusedcode.xml"
output
stdout digest 0xb30e995b46d21fbd548a651c273d58d1bff3b756;
stdout digest fbc6a2e901c82c0ecfca92eb84998db5ea51fc;
description
short "A source code analyzer for Java",
......
......@@ -10,3 +10,34 @@ diff -ur orig/pmd-src-5.7.0/pmd-core/src/main/java/net/sourceforge/pmd/renderers
}
}
}
diff -ur orig/pmd-src-5.7.0/pmd-core/src/main/java/net/sourceforge/pmd/util/datasource/FileDataSource.java pmd-src-5.7.0/pmd-core/src/main/java/net/sourceforge/pmd/util/datasource/FileDataSource.java
index a3691033f..142a10d6e 100644
--- orig/pmd-src-5.7.0/pmd-core/src/main/java/net/sourceforge/pmd/util/datasource/FileDataSource.java
+++ pmd-src-5.7.0/pmd-core/src/main/java/net/sourceforge/pmd/util/datasource/FileDataSource.java
@@ -37,14 +37,19 @@ public class FileDataSource implements DataSource {
}
private String glomName(boolean shortNames, String inputFileName, File file) {
- if (shortNames && inputFileName.indexOf(',') == -1) {
- if (new File(inputFileName).isDirectory()) {
- return trimAnyPathSep(file.getPath().substring(inputFileName.length()));
- } else {
- if (inputFileName.indexOf(FILE_SEPARATOR.charAt(0)) == -1) {
- return inputFileName;
+ if (shortNames) {
+ if (inputFileName != null && inputFileName.indexOf(',') == -1) {
+ if (new File(inputFileName).isDirectory()) {
+ return trimAnyPathSep(file.getPath().substring(inputFileName.length()));
+ } else {
+ if (inputFileName.indexOf(FILE_SEPARATOR.charAt(0)) == -1) {
+ return inputFileName;
+ }
+ return trimAnyPathSep(inputFileName.substring(inputFileName.lastIndexOf(FILE_SEPARATOR)));
}
- return trimAnyPathSep(inputFileName.substring(inputFileName.lastIndexOf(FILE_SEPARATOR)));
+ } else {
+ // if the 'master' file is not specified, just use the file name
+ return file.getName();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment