Skip to content

Commit 6e5e2e6

Browse files
committed
Apply and enforce code formatter
1 parent b77103f commit 6e5e2e6

File tree

374 files changed

+27376
-22040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

374 files changed

+27376
-22040
lines changed

Diff for: build.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
plugins {
33
id 'java-library'
4+
id 'com.diffplug.spotless' version '6.2.0'
45
id 'signing'
56
id 'maven-publish'
67
id 'de.marcphilipp.nexus-publish' version '0.4.0'
@@ -54,6 +55,14 @@ repositories {
5455
mavenCentral()
5556
}
5657

58+
spotless {
59+
java {
60+
palantirJavaFormat()
61+
importOrder 'java', 'javax', 'jakarta', 'org', 'com', ''
62+
removeUnusedImports()
63+
}
64+
}
65+
5766
nexusPublishing {
5867
repositories {
5968
sonatype {

Diff for: src/main/java/org/gitlab4j/api/AbstractApi.java

+90-43
Large diffs are not rendered by default.

Diff for: src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java

+38-36
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import javax.ws.rs.core.Response;
77

8-
import org.gitlab4j.api.models.Setting;
98
import org.gitlab4j.api.models.ApplicationSettings;
9+
import org.gitlab4j.api.models.Setting;
1010
import org.gitlab4j.api.utils.ISO8601;
1111

1212
import com.fasterxml.jackson.databind.JsonNode;
@@ -53,7 +53,7 @@ public ApplicationSettings updateApplicationSettings(ApplicationSettings appSett
5353
}
5454

5555
final GitLabApiForm form = new GitLabApiForm();
56-
appSettings.getSettings().forEach((s, v) -> form.withParam(s, v));
56+
appSettings.getSettings().forEach((s, v) -> form.withParam(s, v));
5757
Response response = put(Response.Status.OK, form.asMap(), "application", "settings");
5858
JsonNode root = response.readEntity(JsonNode.class);
5959
return (parseApplicationSettings(root));
@@ -116,40 +116,42 @@ public static final ApplicationSettings parseApplicationSettings(JsonNode root)
116116

117117
String fieldName = fieldNames.next();
118118
switch (fieldName) {
119-
case "id":
120-
appSettings.setId(root.path(fieldName).asLong());
121-
break;
122-
123-
case "created_at":
124-
try {
125-
String value = root.path(fieldName).asText();
126-
appSettings.setCreatedAt(ISO8601.toDate(value));
127-
} catch (ParseException pe) {
128-
throw new GitLabApiException(pe);
129-
}
130-
break;
131-
132-
case "updated_at":
133-
try {
134-
String value = root.path(fieldName).asText();
135-
appSettings.setUpdatedAt(ISO8601.toDate(value));
136-
} catch (ParseException pe) {
137-
throw new GitLabApiException(pe);
138-
}
139-
break;
140-
141-
default:
142-
143-
Setting setting = Setting.forValue(fieldName);
144-
if (setting != null) {
145-
appSettings.addSetting(setting, root.path(fieldName));
146-
} else {
147-
GitLabApi.getLogger().warning(String.format("Unknown setting: %s, type: %s",
148-
fieldName, root.path(fieldName).getClass().getSimpleName()));
149-
appSettings.addSetting(fieldName, root.path(fieldName));
150-
}
151-
152-
break;
119+
case "id":
120+
appSettings.setId(root.path(fieldName).asLong());
121+
break;
122+
123+
case "created_at":
124+
try {
125+
String value = root.path(fieldName).asText();
126+
appSettings.setCreatedAt(ISO8601.toDate(value));
127+
} catch (ParseException pe) {
128+
throw new GitLabApiException(pe);
129+
}
130+
break;
131+
132+
case "updated_at":
133+
try {
134+
String value = root.path(fieldName).asText();
135+
appSettings.setUpdatedAt(ISO8601.toDate(value));
136+
} catch (ParseException pe) {
137+
throw new GitLabApiException(pe);
138+
}
139+
break;
140+
141+
default:
142+
Setting setting = Setting.forValue(fieldName);
143+
if (setting != null) {
144+
appSettings.addSetting(setting, root.path(fieldName));
145+
} else {
146+
GitLabApi.getLogger()
147+
.warning(String.format(
148+
"Unknown setting: %s, type: %s",
149+
fieldName,
150+
root.path(fieldName).getClass().getSimpleName()));
151+
appSettings.addSetting(fieldName, root.path(fieldName));
152+
}
153+
154+
break;
153155
}
154156
}
155157

Diff for: src/main/java/org/gitlab4j/api/ApplicationsApi.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public Stream<Application> getApplicationsStream() throws GitLabApiException {
8383
* @return the created Application instance
8484
* @throws GitLabApiException if any exception occurs
8585
*/
86-
public Application createApplication(String name, String redirectUri, ApplicationScope[] scopes) throws GitLabApiException {
86+
public Application createApplication(String name, String redirectUri, ApplicationScope[] scopes)
87+
throws GitLabApiException {
8788

8889
if (scopes == null || scopes.length == 0) {
8990
throw new GitLabApiException("scopes cannot be null or empty");
@@ -103,7 +104,8 @@ public Application createApplication(String name, String redirectUri, Applicatio
103104
* @return the created Application instance
104105
* @throws GitLabApiException if any exception occurs
105106
*/
106-
public Application createApplication(String name, String redirectUri, List<ApplicationScope> scopes) throws GitLabApiException {
107+
public Application createApplication(String name, String redirectUri, List<ApplicationScope> scopes)
108+
throws GitLabApiException {
107109

108110
if (scopes == null || scopes.isEmpty()) {
109111
throw new GitLabApiException("scopes cannot be null or empty");
@@ -113,7 +115,7 @@ public Application createApplication(String name, String redirectUri, List<Appli
113115
GitLabApiForm formData = new GitLabApiForm()
114116
.withParam("name", name, true)
115117
.withParam("redirect_uri", redirectUri, true)
116-
.withParam("scopes", scopesString, true);
118+
.withParam("scopes", scopesString, true);
117119
Response response = post(Response.Status.CREATED, formData, "applications");
118120
return (response.readEntity(Application.class));
119121
}

Diff for: src/main/java/org/gitlab4j/api/AuditEventApi.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ public AuditEventApi(GitLabApi gitLabApi) {
3232
* @return a List of group Audit events
3333
* @throws GitLabApiException if any exception occurs
3434
*/
35-
public List<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException {
36-
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).all());
35+
public List<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId)
36+
throws GitLabApiException {
37+
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage())
38+
.all());
3739
}
3840

3941
/**
@@ -49,7 +51,9 @@ public List<AuditEvent> getAuditEvents(Date created_after, Date created_before,
4951
* @return a Pager of group Audit events
5052
* @throws GitLabApiException if any exception occurs
5153
*/
52-
public Pager<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId, int itemsPerPage) throws GitLabApiException {
54+
public Pager<AuditEvent> getAuditEvents(
55+
Date created_after, Date created_before, String entityType, Long entityId, int itemsPerPage)
56+
throws GitLabApiException {
5357
Form form = new GitLabApiForm()
5458
.withParam("created_before", ISO8601.toString(created_before, false))
5559
.withParam("created_after", ISO8601.toString(created_after, false))
@@ -70,7 +74,8 @@ public Pager<AuditEvent> getAuditEvents(Date created_after, Date created_before,
7074
* @return a Stream of group Audit events
7175
* @throws GitLabApiException if any exception occurs
7276
*/
73-
public Stream<AuditEvent> getAuditEventsStream(Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException {
77+
public Stream<AuditEvent> getAuditEventsStream(
78+
Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException {
7479
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).stream());
7580
}
7681

0 commit comments

Comments
 (0)