53 return repository;
54 }
55
56 public CensusConfiguration census() {
57 return census;
58 }
59
60 public ChecksConfiguration checks() {
61 return checks;
62 }
63
64 private static INI convert(INI old) {
65 var project = old.get("project").asString();
66 if (project == null) {
67 throw new IllegalArgumentException("'project' must be specified");
68 }
69
70 var config = new ArrayList<String>();
71 config.add("[general]");
72 config.add("project=" + project);
73
74 config.add("[checks]");
75 var error = "error=blacklist,author,committer,reviewers,merge,hg-tag,message,issues,executable";
76 var shouldCheckWhitespace = false;
77 var checkWhitespace = old.get("whitespace");
78 if (checkWhitespace == null || !checkWhitespace.equals("lax")) {
79 error += ",whitespace";
80 shouldCheckWhitespace = true;
81 }
82 config.add(error);
83
84 if (project.startsWith("jdk")) {
85 config.add("[repository]");
86
87 var tags = "tags=";
88 var checkTags = old.get("tags");
89 if (checkTags == null || !checkTags.equals("lax")) {
90 var jdkTag = "(?:jdk-(?:[1-9]([0-9]*)(?:\\.(?:0|[1-9][0-9]*)){0,4})(?:\\+(?:(?:[0-9]+))|(?:-ga)))";
91 var jdkuTag = "(?:jdk[4-9](?:u\\d{1,3})?-(?:(?:b\\d{2,3})|(?:ga)))";
92 var hsTag = "(?:hs\\d\\d(?:\\.\\d{1,2})?-b\\d\\d)";
93 tags += jdkTag + "|" + jdkuTag + "|" + hsTag;
94 } else {
95 tags += ".*";
96 }
97 config.add(tags);
98
99 var branches = "branches=";
100 var checkBranches = old.get("branches");
101 if (checkBranches != null && checkBranches.equals("lax")) {
102 branches += ".*\n";
103 }
104 config.add(branches);
105 }
106
107 config.add("[census]");
108 config.add("version=0");
109 config.add("domain=openjdk.org");
110
111 if (shouldCheckWhitespace) {
112 config.add("[checks \"whitespace\"]");
113 config.add("files=.*\\.cpp|.*\\.hpp|.*\\.c|.*\\.h|.*\\.java");
114 }
115
116 config.add("[checks \"merge\"]");
117 config.add("message=Merge");
118
119 config.add("[checks \"reviewers\"]");
120 config.add("minimum=1");
121 config.add("role=contributor");
|
53 return repository;
54 }
55
56 public CensusConfiguration census() {
57 return census;
58 }
59
60 public ChecksConfiguration checks() {
61 return checks;
62 }
63
64 private static INI convert(INI old) {
65 var project = old.get("project").asString();
66 if (project == null) {
67 throw new IllegalArgumentException("'project' must be specified");
68 }
69
70 var config = new ArrayList<String>();
71 config.add("[general]");
72 config.add("project=" + project);
73 config.add("jbs=JDK");
74
75 config.add("[checks]");
76 var error = "error=blacklist,author,committer,reviewers,merge,hg-tag,message,issues,executable";
77 var shouldCheckWhitespace = false;
78 var checkWhitespace = old.get("whitespace");
79 if (checkWhitespace == null || !checkWhitespace.asString().equals("lax")) {
80 error += ",whitespace";
81 shouldCheckWhitespace = true;
82 }
83 config.add(error);
84
85 if (project.startsWith("jdk")) {
86 config.add("[repository]");
87
88 var tags = "tags=";
89 var checkTags = old.get("tags");
90 if (checkTags == null || !checkTags.asString().equals("lax")) {
91 var jdkTag = "(?:jdk-(?:[1-9]([0-9]*)(?:\\.(?:0|[1-9][0-9]*)){0,4})(?:\\+(?:(?:[0-9]+))|(?:-ga)))";
92 var jdkuTag = "(?:jdk[4-9](?:u\\d{1,3})?-(?:(?:b\\d{2,3})|(?:ga)))";
93 var hsTag = "(?:hs\\d\\d(?:\\.\\d{1,2})?-b\\d\\d)";
94 tags += jdkTag + "|" + jdkuTag + "|" + hsTag;
95 } else {
96 tags += ".*";
97 }
98 config.add(tags);
99
100 var branches = "branches=";
101 var checkBranches = old.get("branches");
102 if (checkBranches != null && checkBranches.asString().equals("lax")) {
103 branches += ".*\n";
104 }
105 config.add(branches);
106 }
107
108 config.add("[census]");
109 config.add("version=0");
110 config.add("domain=openjdk.org");
111
112 if (shouldCheckWhitespace) {
113 config.add("[checks \"whitespace\"]");
114 config.add("files=.*\\.cpp|.*\\.hpp|.*\\.c|.*\\.h|.*\\.java");
115 }
116
117 config.add("[checks \"merge\"]");
118 config.add("message=Merge");
119
120 config.add("[checks \"reviewers\"]");
121 config.add("minimum=1");
122 config.add("role=contributor");
|