Skip to content

Commit da11702

Browse files
committed
Modify formatting to columnize
Turns out I do care about formatting a little. We have a lot of builders and chained methods. I think it is easier to follow long chains when lined up veritcally.
1 parent f262bf7 commit da11702

61 files changed

Lines changed: 710 additions & 362 deletions

Some content is hidden

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

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
<goal>${formatter-maven-plugin.goal}</goal>
177177
</goals>
178178
<configuration>
179-
<configFile>eclipse/formatter.xml</configFile>
179+
<configFile>src/main/resources/eclipse/formatter.xml</configFile>
180180
</configuration>
181181
</execution>
182182
</executions>

src/main/java/org/kohsuke/github/GHApp.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ GHApp wrapUp(GitHub root) {
183183
@Preview
184184
@Deprecated
185185
public PagedIterable<GHAppInstallation> listInstallations() {
186-
return root.retrieve().withPreview(MACHINE_MAN).asPagedIterable("/app/installations", GHAppInstallation[].class,
187-
item -> item.wrapUp(root));
186+
return root.retrieve()
187+
.withPreview(MACHINE_MAN)
188+
.asPagedIterable("/app/installations", GHAppInstallation[].class, item -> item.wrapUp(root));
188189
}
189190

190191
/**
@@ -202,8 +203,10 @@ public PagedIterable<GHAppInstallation> listInstallations() {
202203
@Preview
203204
@Deprecated
204205
public GHAppInstallation getInstallationById(long id) throws IOException {
205-
return root.retrieve().withPreview(MACHINE_MAN)
206-
.to(String.format("/app/installations/%d", id), GHAppInstallation.class).wrapUp(root);
206+
return root.retrieve()
207+
.withPreview(MACHINE_MAN)
208+
.to(String.format("/app/installations/%d", id), GHAppInstallation.class)
209+
.wrapUp(root);
207210
}
208211

209212
/**
@@ -222,8 +225,10 @@ public GHAppInstallation getInstallationById(long id) throws IOException {
222225
@Preview
223226
@Deprecated
224227
public GHAppInstallation getInstallationByOrganization(String name) throws IOException {
225-
return root.retrieve().withPreview(MACHINE_MAN)
226-
.to(String.format("/orgs/%s/installation", name), GHAppInstallation.class).wrapUp(root);
228+
return root.retrieve()
229+
.withPreview(MACHINE_MAN)
230+
.to(String.format("/orgs/%s/installation", name), GHAppInstallation.class)
231+
.wrapUp(root);
227232
}
228233

229234
/**
@@ -244,7 +249,8 @@ public GHAppInstallation getInstallationByOrganization(String name) throws IOExc
244249
@Preview
245250
@Deprecated
246251
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
247-
return root.retrieve().withPreview(MACHINE_MAN)
252+
return root.retrieve()
253+
.withPreview(MACHINE_MAN)
248254
.to(String.format("/repos/%s/%s/installation", ownerName, repositoryName), GHAppInstallation.class)
249255
.wrapUp(root);
250256
}
@@ -264,8 +270,10 @@ public GHAppInstallation getInstallationByRepository(String ownerName, String re
264270
@Preview
265271
@Deprecated
266272
public GHAppInstallation getInstallationByUser(String name) throws IOException {
267-
return root.retrieve().withPreview(MACHINE_MAN)
268-
.to(String.format("/users/%s/installation", name), GHAppInstallation.class).wrapUp(root);
273+
return root.retrieve()
274+
.withPreview(MACHINE_MAN)
275+
.to(String.format("/users/%s/installation", name), GHAppInstallation.class)
276+
.wrapUp(root);
269277
}
270278

271279
}

src/main/java/org/kohsuke/github/GHAuthorization.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ GHAuthorization wrap(GitHub root) {
158158
return this;
159159
}
160160

161-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
162-
"UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
161+
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
162+
justification = "JSON API")
163163
private static class App {
164164
private String url;
165165
private String name;

src/main/java/org/kohsuke/github/GHBranch.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
*
1515
* @author Yusuke Kokubo
1616
*/
17-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
18-
"URF_UNREAD_FIELD" }, justification = "JSON API")
17+
@SuppressFBWarnings(
18+
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
19+
"URF_UNREAD_FIELD" },
20+
justification = "JSON API")
1921
public class GHBranch {
2022
private GitHub root;
2123
private GHRepository owner;
@@ -141,13 +143,15 @@ public GHBranchProtectionBuilder enableProtection() {
141143
@Deprecated
142144
public void enableProtection(EnforcementLevel level, Collection<String> contexts) throws IOException {
143145
switch (level) {
144-
case OFF:
145-
disableProtection();
146-
break;
147-
case NON_ADMINS:
148-
case EVERYONE:
149-
enableProtection().addRequiredChecks(contexts).includeAdmins(level == EnforcementLevel.EVERYONE).enable();
150-
break;
146+
case OFF :
147+
disableProtection();
148+
break;
149+
case NON_ADMINS :
150+
case EVERYONE :
151+
enableProtection().addRequiredChecks(contexts)
152+
.includeAdmins(level == EnforcementLevel.EVERYONE)
153+
.enable();
154+
break;
151155
}
152156
}
153157

src/main/java/org/kohsuke/github/GHBranchProtection.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
/**
1212
* The type GHBranchProtection.
1313
*/
14-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
15-
"URF_UNREAD_FIELD" }, justification = "JSON API")
14+
@SuppressFBWarnings(
15+
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
16+
"URF_UNREAD_FIELD" },
17+
justification = "JSON API")
1618
public class GHBranchProtection {
1719
private static final String REQUIRE_SIGNATURES_URI = "/required_signatures";
1820

src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
*
2020
* @see GHBranch#enableProtection() GHBranch#enableProtection()
2121
*/
22-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
23-
"URF_UNREAD_FIELD" }, justification = "JSON API")
22+
@SuppressFBWarnings(
23+
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
24+
"URF_UNREAD_FIELD" },
25+
justification = "JSON API")
2426
public class GHBranchProtectionBuilder {
2527
private final GHBranch branch;
2628

@@ -86,10 +88,13 @@ public GHBranchProtectionBuilder dismissStaleReviews(boolean v) {
8688
* the io exception
8789
*/
8890
public GHBranchProtection enable() throws IOException {
89-
return requester().method("PUT").withNullable("required_status_checks", statusChecks)
90-
.withNullable("required_pull_request_reviews", prReviews).withNullable("restrictions", restrictions)
91+
return requester().method("PUT")
92+
.withNullable("required_status_checks", statusChecks)
93+
.withNullable("required_pull_request_reviews", prReviews)
94+
.withNullable("restrictions", restrictions)
9195
.withNullable("enforce_admins", enforceAdmins)
92-
.to(branch.getProtectionUrl().toString(), GHBranchProtection.class).wrap(branch);
96+
.to(branch.getProtectionUrl().toString(), GHBranchProtection.class)
97+
.wrap(branch);
9398
}
9499

95100
/**

src/main/java/org/kohsuke/github/GHCommit.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public class GHCommit {
2727
/**
2828
* Short summary of this commit.
2929
*/
30-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
31-
"NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
30+
@SuppressFBWarnings(
31+
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
32+
"UWF_UNWRITTEN_FIELD" },
33+
justification = "JSON API")
3234
public static class ShortInfo {
3335
private GHAuthor author;
3436
private GHAuthor committer;
@@ -167,7 +169,8 @@ public String getStatus() {
167169
*
168170
* @return Full path in the repository.
169171
*/
170-
@SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library's API and cannot be renamed")
172+
@SuppressFBWarnings(value = "NM_CONFUSING",
173+
justification = "It's a part of the library's API and cannot be renamed")
171174
public String getFileName() {
172175
return filename;
173176
}
@@ -344,7 +347,7 @@ public String getSHA1() {
344347
*/
345348
public List<File> getFiles() throws IOException {
346349
populate();
347-
return files != null ? Collections.unmodifiableList(files) : Collections.<File> emptyList();
350+
return files != null ? Collections.unmodifiableList(files) : Collections.<File>emptyList();
348351
}
349352

350353
/**
@@ -438,9 +441,11 @@ private GHUser resolveUser(User author) throws IOException {
438441
* @return {@link PagedIterable} with all the commit comments in this repository.
439442
*/
440443
public PagedIterable<GHCommitComment> listComments() {
441-
return owner.root.retrieve().asPagedIterable(
442-
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
443-
GHCommitComment[].class, item -> item.wrap(owner));
444+
return owner.root.retrieve()
445+
.asPagedIterable(
446+
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
447+
GHCommitComment[].class,
448+
item -> item.wrap(owner));
444449
}
445450

446451
/**
@@ -461,7 +466,9 @@ public PagedIterable<GHCommitComment> listComments() {
461466
* if comment is not created
462467
*/
463468
public GHCommitComment createComment(String body, String path, Integer line, Integer position) throws IOException {
464-
GHCommitComment r = new Requester(owner.root).with("body", body).with("path", path).with("line", line)
469+
GHCommitComment r = new Requester(owner.root).with("body", body)
470+
.with("path", path)
471+
.with("line", line)
465472
.with("position", position)
466473
.to(String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
467474
GHCommitComment.class);

src/main/java/org/kohsuke/github/GHCommitComment.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* @see GHCommit#createComment(String, String, Integer, Integer) GHCommit#createComment(String, String, Integer,
1717
* Integer)
1818
*/
19-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
20-
"NP_UNWRITTEN_FIELD" }, justification = "JSON API")
19+
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
20+
justification = "JSON API")
2121
public class GHCommitComment extends GHObject implements Reactable {
2222
private GHRepository owner;
2323

@@ -120,15 +120,18 @@ public void update(String body) throws IOException {
120120
@Preview
121121
@Deprecated
122122
public GHReaction createReaction(ReactionContent content) throws IOException {
123-
return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
124-
.to(getApiTail() + "/reactions", GHReaction.class).wrap(owner.root);
123+
return new Requester(owner.root).withPreview(SQUIRREL_GIRL)
124+
.with("content", content.getContent())
125+
.to(getApiTail() + "/reactions", GHReaction.class)
126+
.wrap(owner.root);
125127
}
126128

127129
@Preview
128130
@Deprecated
129131
public PagedIterable<GHReaction> listReactions() {
130-
return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiTail() + "/reactions",
131-
GHReaction[].class, item -> item.wrap(owner.root));
132+
return owner.root.retrieve()
133+
.withPreview(SQUIRREL_GIRL)
134+
.asPagedIterable(getApiTail() + "/reactions", GHReaction[].class, item -> item.wrap(owner.root));
132135
}
133136

134137
/**

src/main/java/org/kohsuke/github/GHCompare.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ public GHCompare wrap(GHRepository owner) {
163163
* Compare commits had a child commit element with additional details we want to capture. This extenstion of
164164
* GHCommit provides that.
165165
*/
166-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
167-
"UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
166+
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
167+
justification = "JSON API")
168168
public static class Commit extends GHCommit {
169169

170170
private InnerCommit commit;

src/main/java/org/kohsuke/github/GHContent.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,11 @@ public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessa
306306
throws IOException {
307307
String encodedContent = Base64.encodeBase64String(newContentBytes);
308308

309-
Requester requester = new Requester(root).with("path", path).with("message", commitMessage).with("sha", sha)
310-
.with("content", encodedContent).method("PUT");
309+
Requester requester = new Requester(root).with("path", path)
310+
.with("message", commitMessage)
311+
.with("sha", sha)
312+
.with("content", encodedContent)
313+
.method("PUT");
311314

312315
if (branch != null) {
313316
requester.with("branch", branch);
@@ -347,7 +350,9 @@ public GHContentUpdateResponse delete(String message) throws IOException {
347350
* the io exception
348351
*/
349352
public GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException {
350-
Requester requester = new Requester(root).with("path", path).with("message", commitMessage).with("sha", sha)
353+
Requester requester = new Requester(root).with("path", path)
354+
.with("message", commitMessage)
355+
.with("sha", sha)
351356
.method("DELETE");
352357

353358
if (branch != null) {

0 commit comments

Comments
 (0)