Skip to content

Commit 6de5547

Browse files
Disable snakeyml warning for duplicate keys (#175)
* disable snakeyml warning for duplicate keys completely
1 parent 1a28bc9 commit 6de5547

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

plugin/src/main/java/org/owasp/benchmarkutils/score/Configuration.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.InputStream;
2323
import java.io.SequenceInputStream;
2424
import java.util.Map;
25+
import org.yaml.snakeyaml.LoaderOptions;
2526
import org.yaml.snakeyaml.Yaml;
2627

2728
/**
@@ -76,7 +77,16 @@ public class Configuration {
7677

7778
public final Report report;
7879

79-
private static final Yaml yaml = new Yaml();
80+
private static final Yaml yaml = new Yaml(defaultLoaderOptions());
81+
82+
private static LoaderOptions defaultLoaderOptions() {
83+
LoaderOptions loaderOptions = new LoaderOptions();
84+
85+
loaderOptions.setAllowDuplicateKeys(true);
86+
loaderOptions.setWarnOnDuplicateKeys(false);
87+
88+
return loaderOptions;
89+
}
8090

8191
public static Configuration fromDefaultConfig() {
8292
return fromInputStream(resourceAsStream(DEFAULT_CONFIG), DEFAULT_SUCCESS_MESSAGE);

plugin/src/test/java/org/owasp/benchmarkutils/score/BenchmarkScoreTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
public class BenchmarkScoreTest {
3030

31-
private static final String SEP = System.getProperty("line.separator");
31+
private static final String SEP = System.lineSeparator();
3232
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
3333
private final PrintStream originalOut = System.out;
3434

0 commit comments

Comments
 (0)